The QGraphicsRotation class provides a rotation transformation around a given axis. More...
#include <QGraphicsRotation>
Inherits: QGraphicsTransform.
This class was introduced in Qt 4.6.
QGraphicsRotation ( QObject * parent = 0 ) | |
~QGraphicsRotation () | |
qreal | angle () const |
QVector3D | axis () const |
QVector3D | origin () const |
void | setAngle ( qreal ) |
void | setAxis ( const QVector3D & axis ) |
void | setAxis ( Qt::Axis axis ) |
void | setOrigin ( const QVector3D & point ) |
virtual void | applyTo ( QMatrix4x4 * matrix ) const |
void | angleChanged () |
void | axisChanged () |
void | originChanged () |
The QGraphicsRotation class provides a rotation transformation around a given axis.
You can provide the desired axis by assigning a QVector3D to the axis property or by passing a member if Qt::Axis to the setAxis convenience 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.
QGraphicsRotation provides 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 QPointF(0, 0).
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.
See also QGraphicsTransform, QGraphicsItem::setRotation(), and QTransform::rotate().
This property holds the angle for clockwise rotation, in degrees.
The angle can be any real number; the default value is 0.0. A value of 180 will rotate 180 degrees, clockwise. If you provide a negative number, the item will be rotated counter-clockwise. Normally the rotation angle will be in the range (-360, 360), but you can also provide numbers outside of this range (e.g., a angle of 370 degrees gives the same result as 10 degrees). Setting the angle to NaN results in no rotation.
Access functions:
qreal | angle () const |
void | setAngle ( qreal ) |
Notifier signal:
void | angleChanged () |
See also origin.
This property holds a rotation axis, specified by a vector in 3D space.
This can be any axis in 3D space. By default the axis is (0, 0, 1), which is aligned with the Z axis. If you provide another axis, QGraphicsRotation will provide a transformation that rotates around this axis. For example, if you would like to rotate an item around its X axis, you could pass (1, 0, 0) as the axis.
Access functions:
QVector3D | axis () const |
void | setAxis ( const QVector3D & axis ) |
void | setAxis ( Qt::Axis axis ) |
Notifier signal:
void | axisChanged () |
See also QTransform and QGraphicsRotation::angle.
This property holds the origin of the rotation in 3D space.
All rotations will be done relative to this point (i.e., this point will stay fixed, relative to the parent, when the item is rotated).
Access functions:
QVector3D | origin () const |
void | setOrigin ( const QVector3D & point ) |
Notifier signal:
void | originChanged () |
See also angle.
Constructs a new QGraphicsRotation with the given parent.
Destroys the graphics rotation.
This signal is emitted whenever the angle has changed.
See also QGraphicsRotation::angle.
Reimplemented from QGraphicsTransform::applyTo().
This signal is emitted whenever the axis of the object changes.
See also QGraphicsRotation::axis.
This signal is emitted whenever the origin has changed.
See also QGraphicsRotation::origin.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.