New in version 4.6.
You can provide the desired axis by assigning a
QVector3Dto the axis property or by passing a member if
setAxisconvenience function. By default the axis is (0, 0, 1) i.e., rotation around the Z axis.
The angle property, which is provided by
QGraphicsRotation, now describes the number of degrees to rotate around this axis.
QGraphicsRotationprovides certain parameters to help control how the rotation should be applied.
The origin is the point that the item is rotated around (i.e., it stays fixed relative to the parent as the rest of the item is rotated). By default the origin is
The angle property provides the number of degrees to rotate the item clockwise around the origin. This value also be negative, indicating a counter-clockwise rotation. For animation purposes it may also be useful to provide rotation angles exceeding (-360, 360) degrees, for instance to animate how an item rotates several times.
Note: the final rotation is the combined effect of a rotation in 3D space followed by a projection back to 2D. If several rotations are performed in succession, they will not behave as expected unless they were all around the Z axis.
- param parent
Constructs a new
QGraphicsRotationwith the given
Convenience function to set the axis to
QTransformis inverted from the correct mathematical rotation in 3D space. The
QGraphicsRotationclass implements a correct mathematical rotation. The following two sequences of code will perform the same transformation:
QTransform t; t.rotate(45, Qt::YAxis); QGraphicsRotation r; r.setAxis(Qt::YAxis); r.setAngle(-45);
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.