jendral_hxr
24th May 2011, 18:04
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'.
https://lh4.googleusercontent.com/_gl7_eIPWXvs/TdvjWxshCoI/AAAAAAAAAOQ/d7KZE3r9-Yc/some.png
xGraph->updateCurve(xGraph->getValue()+2.4);
xGraph->updateCurve(xGraph->getValue()+3.4);
xGraph->updateCurve(xGraph->getValue()-9.8);
xGraph->updateCurve(xGraph->getValue()+2.8);....
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);
}
}
};
https://lh6.googleusercontent.com/_gl7_eIPWXvs/TdvjeMv2knI/AAAAAAAAAOU/Pyerwz0MUM0/satu.png
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. ;)
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'.
https://lh4.googleusercontent.com/_gl7_eIPWXvs/TdvjWxshCoI/AAAAAAAAAOQ/d7KZE3r9-Yc/some.png
xGraph->updateCurve(xGraph->getValue()+2.4);
xGraph->updateCurve(xGraph->getValue()+3.4);
xGraph->updateCurve(xGraph->getValue()-9.8);
xGraph->updateCurve(xGraph->getValue()+2.8);....
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);
}
}
};
https://lh6.googleusercontent.com/_gl7_eIPWXvs/TdvjeMv2knI/AAAAAAAAAOU/Pyerwz0MUM0/satu.png
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. ;)