Reputation: 19
I want to transform a QGraphicsItem
by its Qt::YAxis
, what works very well.
QTransform trans;
trans.rotate (value, Qt::YAxis);
item->setTransformOriginPoint (0,0);
//item->setTransformOriginPoint (500, 250);
item->setTransform (trans);
The problem i have is that the setTransformOriginPoint
seems to be ignored 'cause it dont work. Everytime my item transforms at its left-side. But i want to transform it by its right-side and i think i am affected by this bug:
Can someone confirm a similar problem like this?
Or what i can do to transform my item at its right-side?
Edit: Sorry i forgot to say that i not use an animation like described at this bug-report!
Upvotes: 1
Views: 3289
Reputation: 12832
A QTransform
has everything about the transformation, include the origins where you want the transform to happen. setTransformOriginPoint()
only affect simple functions like rotate()
that does not specify the origins.
Try adding translate to your QTransform before adding rotate().
QTransform trans;
trans.translate(500, 250).rotate(value, Qt::YAxis);
item->setTransform(trans);
Edit:
Yes, QTransform
in QGraphicsItem
is not very straightforward to use. It's also really limited on what you can do. Starting with Qt 4.6, QGraphicsTransform
can be used for higher level of control on the transformation. That may be what you are looking for.
Upvotes: 3