Hi,
I just want to know if it is possible to make Qwt do the curve rendering in a thread ?
I have curves with a lot of point to render and thus, it is quite slow and freeze the user interface.
Regards,
Hi,
I just want to know if it is possible to make Qwt do the curve rendering in a thread ?
I have curves with a lot of point to render and thus, it is quite slow and freeze the user interface.
Regards,
Hi, you can do your calculations in a separate thread, but you cannot draw directly into the gui thread, instead send some kind of notification message if one calculation is complete.
Ginsengelf
As long as you didn't disable QwtPlotCanvas::PaintCached the content of the canvas is rendered to a pixmap cache, before it is painted to the widget. So what you can try is to overload YourPlot::drawCanvas, where you somehow delegate QwtPlot::drawCanvas to a temporary pixmap into a different thread. When it is done you can replace the canvas paint cache with your pixmap.
But I guess it is easier to optimize the performance of your replot operations. QwtPlotCurve::PaintFiltered might help. If this is not enough you should implement something like level of details ( skipping of points, depending on the zoom level ).
Uwe
viridis (3rd October 2008)
I noticed that the rendering occurs in a pixmap and that why I though of the thread possibility.
I will give it a try if I have enough time.
For the level of details, I though about it too. Indeed it was the second question of my previous post, but I removed it as I noticed what I need is a low pass filter with resampling... which is quite complicated !
I have tried to skip points, but it is really not appropriate for my data. I have tried to draw a point only if it is far enough of the previous one too. This last one works very well for some curves (~500 points instead of 120000 !) but not for all (~88000 points instead of 120000 which too big).
A related problem is that I retrieve my data directly from a QAbstractItemModel, which works with QVariants, and its seems really slow for this problem. I will try to implement a cache for my "double" values here to avoid the QVariant.
You can access almost everything through the QAbstractItemModel API, but of course such a design can't be as effective as a array of points.
I recommend to store your values in something like a QVector<QPointF> and to implement/use a model ( for your Qt widgets ) + a QwtData object ( for QwtPlot ) on top of it.
Uwe
Bookmarks