Originally Posted by
c_srikanth1984
What i need to do to rotate item from its center point.
By-default the rotation point it the origin of that item i.e. topleft corner.
To translate around an arbitrary point (x, y), you need to combine translation and rotation with setTransform().
Example:
// Rotate an item 45 degrees around (0, 0).
item->rotate(45);
// Rotate an item 45 degrees around (x, y).
item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));
Example:
// Rotate an item 45 degrees around (0, 0).
item->rotate(45);
// Rotate an item 45 degrees around (x, y).
item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));
To copy to clipboard, switch view to plain text mode
Bookmarks