Any time after you know the rect is going to change and before you relinquish control of the flow to the event loop.
Correct.Does this mean I don't need to call update()?
A very odd situation.Say I have a QGraphicsItem subclass whose boundingRect() function returns a rectangle that is a static class member.
You just need to update the static variable and call prepareGeometryChange() on every instance of the class.If I want update the static rectangle, do I have to call prepareGeometryChange() on every instance of the class, update the static rectangle, and then call update() on every instance?
It calls boundingRect(). That's why prepareGeometryChange() is required -- it essentially tells graphics view to remove any cached values regarding the size of the object and requery them from the object again.
Basically yes.Does this mean that after you call prepareGeometryChange() the scene begins polling for changes, by calling QGraphicsItem::boundingRect() and comparing that one with what it has stored?
The scene updates its structures when it decides they need updating. A rule of thumb is that it will happen when some event regarding the scene is being processed.Does this mean that QGraphicsScene only polls for a change right before control goes back to the event loop (and of course, only if prepareGeometryChange() has been called)?
Bookmarks