PDA

View Full Version : best way to add widget to QGraphicsView



wagmare
25th September 2013, 05:39
hi,
Im having a opengl viewport QGraphicsView which dynamically load a image and a check box pair in its scene .
I made a QGraphicsPixmapItem and adding it to a QGraphicsLinearlayout
in QGraphicsPixmapItem im able to optimize the cache to load 1000 pixmap at a time.

now i need a QGraphicsProxyWidget to be optimize so i can render 1000 QCheckBox fast as i can along with the pixmap item..
I need suggestion from some experts

i m following the thread
http://www.qtcentre.org/threads/37981-Performance-issue-with-complex-QGraphicsScene

wysota
25th September 2013, 05:59
What kind of suggestions?

wagmare
25th September 2013, 06:08
first thanks for the reply
similar like how u gave

I can suggest a couple of things to try:
1. enable caching for items (as suggested by my preposter but with ItemCoordinateCache)
2. set ItemHasNoContents flag on all items that paint nothing
3. set "interactive" property of the view to false if you don't need your scene to be clickable
4. make shapes as simple as you can, if you scale use the level of detail information to avoid painting things that can't be noticed by the user
5. make use of drawBackground() and drawForeground() instead of having items that cover the whole scene
6. avoid clipping
7. try using the raster engine instead of OpenGL.
is there any specific things for QGraphicsProxyWidget ..?

wysota
25th September 2013, 06:16
There is one -- don't use QGraphicsProxyWidget.

wagmare
25th September 2013, 06:22
don't use QGraphicsProxyWidget.

but how i can add a QCheckBox to the scene ..?

wysota
25th September 2013, 06:31
Either draw the checkbox yourself using QStyle or replace the checkbox with something else.