Pardon me, I am new here.
There's been similar threads with similar problem, but there's yet real answer.
I have a class which contains both QwtPlot, QwtPlotCurve and its array of data. I have certain function to update 'em.
Calling the function manually yields the desired result: last value of graph is updated while data are shifted to 'front'.
xGraph->updateCurve(xGraph->getValue()+2.4);
xGraph->updateCurve(xGraph->getValue()+3.4);
xGraph->updateCurve(xGraph->getValue()-9.8);
xGraph->updateCurve(xGraph->getValue()+2.8);....
xGraph->updateCurve(xGraph->getValue()+2.4);
xGraph->updateCurve(xGraph->getValue()+3.4);
xGraph->updateCurve(xGraph->getValue()-9.8);
xGraph->updateCurve(xGraph->getValue()+2.8);....
To copy to clipboard, switch view to plain text mode
But using QThread (which I badly need to update the plot realtime), after I started the thread, the plot's just updated once. It's also no luck with me with QTimer timeout() signal--it yields similar result.
class graphthread
: public QThread{ public:
graphs *yeah;
graphthread(graphs *hereitis){
yeah=hereitis;
}
void run(){
while (1){
yeah->updateCurve(yeah->getValue()+0.4);
// printf("%f\n",yeah->getValue()); // the plot won't update but this's repeatedly printed
msleep(2000);
}
}
};
class graphthread : public QThread{
public:
graphs *yeah;
graphthread(graphs *hereitis){
yeah=hereitis;
}
void run(){
while (1){
yeah->updateCurve(yeah->getValue()+0.4);
// printf("%f\n",yeah->getValue()); // the plot won't update but this's repeatedly printed
msleep(2000);
}
}
};
To copy to clipboard, switch view to plain text mode
note that there's little elevation in the rightmost
'd anyone like to show me where I am doing wrong?
Any help would be appreciated.
Bookmarks