PDA

View Full Version : Dragging multiple Qt4 QGraphicsItems MUCH slower than Qt3 QCanvasItems



philw
4th March 2009, 03:58
When selecting and dragging about 20 QGraphicsItems (with 40x40 pixel pixmaps), move updates are VERY slow. Doing the same with Qt3 Compatibility Library QCanvasItems there is NO delay (all in the same build). We're using Qt 4.3.3 on Windows and Solaris.

I've tried refraining from setting antialiasing and SmoothPixmapTranform render hints -- no noticeable difference in terms of speed. (But the effect of doing so is apparent in terms of graphics quality).

We're not yet ready to build with newer versions of Qt (e.g. Qt 4.4) -- that's coming. Has this been addressed, or is there anything we can do about this?

aamer4yu
4th March 2009, 04:40
Strange that something in Qt3 works faster than in Qt4 !
still there are improvements in Qt 4.4 with introduction of cache mode for graphicsitems.
And in Qt 4.5 there are many improvements (http://labs.trolltech.com/blogs/2009/03/03/performance-and-qt-45/)

You can refer this link too (http://labs.trolltech.com/blogs/2009/02/06/improvements-to-qgraphicsitemcachemodes-insides/)

Yet, am not sure why ur code in 4.3 is running slower than Qt 3 :(

wysota
6th March 2009, 22:19
Try profiling the application to see what causes the slowdown. Without any details on the situation we can't help you in any way and I doubt just upgrading to Qt 4.4 or 4.5 would help significantly. I can assure you I can drag many GV items without slowdowns.

philw
6th March 2009, 22:52
... Thanks, yes. We will try profiling with Purify.

We tried two things (still in Qt 4.3): (1) A test with just an empty QGraphicsPixmapItem subclass without any processing on events (i.e. no virtual method re-implementations), and also (2) recoding to "composite" two child QGraphicsItems (a Pixmap item and a Text item) instead of doing our own drawing. Both helped only a little. (About the same. Very slow drag-moving with twenty 40x40 icons items selected, even without text drawing). So maybe we're doing something to the QGraphicsScene or QGraphicsView which is bad? We should profile.

Here's an article discussing basically this problem back in 2007 with Qt 4.2, with some suggestions ... Qt: Improving QGraphicsView Performance (http://thesmithfam.org/blog/2007/02/03/qt-improving-qgraphicsview-performance/) ..
http://thesmithfam.org/blog/2007/02/03/qt-improving-qgraphicsview-performance/

The new White Paper from Nokia ... Ensuring Maximum Performance with Qt (http://www.qtsoftware.com/forms/whitepapers/reg-whitepaper-performance) .. (free download with registration) .. makes Qt 4.5 look VERY promising. I can't wait to give that a try. http://www.qtsoftware.com/forms/whitepapers/reg-whitepaper-performance

wysota
7th March 2009, 09:06
Is it possible for you to share some of the code with us? Especially the implementation of items you use.