PDA

View Full Version : QGraphicsItem::paint called more often on some zoom levels



veiovis
5th August 2014, 10:26
Hello,

I have a QGraphicsScene with hierarchical statechart in it. So, I have a state in a state in a state...

The user can zoom in.
On some zoom levels the paint function is called on every item movement and on other zoom levels almost never.

I made a small video of it :):
https://www.youtube.com/watch?v=9DkXu6f0rj8&feature=youtu.be
In the console output you can see when the paint function is called for every item and the their level of detail value.
At second 6 you can see that the toplevelstate is repainted on every movement, although in second 5 no repaint was requested (in both zoom levels the item as not completely visible).
At second 11 you can see that all items that occupy the visible rectangle are requested to repaint on the item movement. In second 13 now repaint is requested although the same items are visible.

The items have setCacheMode(DeviceCoordinateCache); set and the QGraphicsView is set to QGraphicsView::MinimalViewportUpdate.

On what do these repaint requests depend and how can I fix it? :)

Thanks in advance
veiois