Hi..All you need to do is re-implement widgets paintevent() with your real time data. Mostly you may need to use drawLine() function of QPainter.
sample logic:
QList<QPair<double,double> > realData; //initialize with ur data
{
for(int i=0; i<realData.count()-1; i++)
{
painter.
drawLine(QPointF(realData.
at(i
).
first,realData.
at(i
).
second),
QPointF(realData.
at(i
+1).
first,realData.
at(i
+1).
second));
}
}
QList<QPair<double,double> > realData; //initialize with ur data
void paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setPen(QPen(QColor(200,100,0)));
for(int i=0; i<realData.count()-1; i++)
{
painter.drawLine(QPointF(realData.at(i).first,realData.at(i).second),QPointF(realData.at(i+1).first,realData.at(i+1).second));
}
}
To copy to clipboard, switch view to plain text mode
You can check the sample codes and qt documentation for custom painting.
Bookmarks