Reputation: 456
Is there a way to resize a QGraphicsItem to a fixed size? I know it can be done with scale(float, float), but that seems like a bad direction to go when wanting to resize the item with mouse event. Is there a way to change the boundingRect() so that the Item will then fit the new size?
Thanks
Upvotes: 0
Views: 165
Reputation: 605
May be too late.
But probably my code at Github PGraphicsItem.py helps you. I derived my own GraphicsItem class from QtGui.QGraphicsItem. There I set the size/scale in the paint method which you need to override.
The scaling factors I get from PGraphicsView.py where I subclassed QtGui.QGraphicsView. It holds a method wheelEvent which calculates scaling factors from mouse wheel increments.
EDIT: In the PGraphicsView.py its the method adjustMarkerSize that recalculates the items to a fixed pixel size.
I do not no if that fits exactly to the question.
Upvotes: 1