I am scaling a QGraphicsItem in some parts of the my pyqt code. In another section of my code when I call self.rect.adjusted(0, 0, 0, 0) it returns the dimensions before transformation. My question is how can I find the dimensions after transformation?
1 Answers
After the transformation can ask for the sceneBoundingRect () or call boundingRegion () that is used for greater precision than boundingRect (). This function is in QGraphicsItem. In the QtAssistant you can read more about that:
The bounding region describes a coarse outline of the item's visual contents. Although it's expensive to calculate, it's also more precise than boundingRect(), and it can help to avoid unnecessary repainting when an item is updated. This is particularly efficient for thin items (e.g., lines or simple polygons). You can tune the granularity for the bounding region by calling setBoundingRegionGranularity(). The default granularity is 0; in which the item's bounding region is the same as its bounding rect. itemToDeviceTransform is the transformation from item coordinates to device coordinates. If you want this function to return a QRegion in scene coordinates, you can pass sceneTransform() as an argument.

- 10,403
- 14
- 67
- 117