setAxisScale( xBottom, 0.0,512.0,50.0 );
setAutoReplot(true);
setAxisScale( yLeft, 0.0, 255.0,50.0);
canvas()->setLineWidth( 1 );
canvas()->setBorderRadius( 1 );
canvasPalette.
setColor( QPalette::Foreground,
QColor( 133,
190,
232 ) );
canvas()->setPalette( canvasPalette );
d_curves
->setPen
( QPen( QColor( 200,
150,
50 ),
1.5 ) );
d_curves->setRawSamples( xval, yval, Size );
d_curves->attach(this);
(void)startTimer(250);
}
{
newCurveData();
replot();
}
void MainWin::newCurveData()
{
QFile file("val/measure.txt");
printf("cannot open");
}
int j=0;
for(j=0;j<=512;j++)
{
xval[j] = j;
yval[j]=line.toDouble();
}
}
MainWin::MainWin( QWidget *parent): QwtPlot( parent ){
setAxisScale( xBottom, 0.0,512.0,50.0 );
setAutoReplot(true);
setAxisScale( yLeft, 0.0, 255.0,50.0);
canvas()->setLineWidth( 1 );
canvas()->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas()->setBorderRadius( 1 );
QPalette canvasPalette;
canvasPalette.setColor( QPalette::Background, QColor( 30, 30, 50 ) );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas()->setPalette( canvasPalette );
QwtPlotCurve *d_curves=new QwtPlotCurve();
d_curves->setSymbol( new QwtSymbol( QwtSymbol::NoSymbol, Qt::NoBrush,
QPen( Qt::black ), QSize( 5, 5 ) ) );
d_curves->setPen( QPen( QColor( 200, 150, 50 ), 1.5 ) );
d_curves->setStyle( QwtPlotCurve::Lines );
d_curves->setRenderHint( QwtPlotCurve::RenderAntialiased );
d_curves->setRawSamples( xval, yval, Size );
d_curves->attach(this);
(void)startTimer(250);
}
void MainWin::timerEvent(QTimerEvent *)
{
newCurveData();
replot();
}
void MainWin::newCurveData()
{
QFile file("val/measure.txt");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
printf("cannot open");
}
QTextStream in(&file);
int j=0;
for(j=0;j<=512;j++)
{
QString line=in.readLine();
xval[j] = j;
yval[j]=line.toDouble();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks