PDA

View Full Version : QWidget seems to perform faster than QGraphicsWidget when drawing text, how come?



moldovan_catalin
14th May 2010, 11:03
Hi,
I've tried porting the Flickable embedded demo from using a QWidget to a QGraphicsWidget and Graphics View architecture on Symbian.
What I did was to have a list widget that contains a layout to which I add a number of small text widgets that act as the list items.What I've noticed is that there is a huge difference between the speed of scrolling with the Flickable example and with my graphics widget implementation. And I can't find the answer to that or how could I improve this to work smoothly on the graphics architecture. I have to mention that the graphics architecture does it's job right of painting only the visible items in the scene. I've also noticed that in landscape mode where I have only 4 widgets visible in the list versus 7 in portrait mode the speed improvement is highly visible so apparently the painting speed is affected by the number of visible widgets in the view. I've also tried using different caching modes for the widgets to improve performance but it seems that they just made it worse. My question is how the same amount of text is drawn so fast in QWidget implementation and so slow in QGraphicsWidget? and what could I do to improve performance?

P.S. I have to mention I've tried also using QFont::NoAntialising but there was not visible speed improvement in drawing.

aamer4yu
14th May 2010, 11:22
What I did was to have a list widget that contains a layout to which I add a number of small text widgets that act as the list items.
That itself seems to be bottleneck. One does not usually add many widgets as items to QListWidget

moldovan_catalin
14th May 2010, 14:45
I'm sorry I've not properly explained it, I'm not using a QListWidget but a QGraphicsWidget, that acts like a container for a list of smaller QGraphicsWidgets that are painting text inside. My problem is that event though the graphics architecture calls paint only on visible widgets (around 7) it is very slow so my kinetic animation is very slow (I've noticed that the more text I have in the widgets the slower the painting, I also know that painting text it is slow from gunnar's (http://labs.trolltech.com/blogs/2010/01/18/qt-graphics-and-performance-fast-text/) posts but it's just too slow in my case. I have a similar pure Symbian implementation that is at least five times faster so I know the device is capable just can't find the bottleneck).
If someone thinks could help by looking at the source code I'll provide that too.

moldovan_catalin
14th May 2010, 15:11
Here is the source code 4633.

honeymagico
13th January 2011, 08:58
maybe your device don't support floating-point arithmetic native...

QGraphicsView uses floating-point everywhere.