Qt 4.8
|
The QGraphicsRotation class provides a rotation transformation around a given axis. More...
#include <qgraphicstransform.h>
Signals | |
void | angleChanged () |
This signal is emitted whenever the angle has changed. More... | |
void | axisChanged () |
This signal is emitted whenever the axis of the object changes. More... | |
void | originChanged () |
This signal is emitted whenever the origin has changed. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Public Functions | |
qreal | angle () const |
void | applyTo (QMatrix4x4 *matrix) const |
Reimplemented Function More... | |
QVector3D | axis () const |
QVector3D | origin () const |
QGraphicsRotation (QObject *parent=0) | |
Constructs a new QGraphicsRotation with the given parent. More... | |
void | setAngle (qreal) |
void | setAxis (const QVector3D &axis) |
void | setAxis (Qt::Axis axis) |
Convenience function to set the axis to axis. More... | |
void | setOrigin (const QVector3D &point) |
~QGraphicsRotation () | |
Destroys the graphics rotation. More... | |
Public Functions inherited from QGraphicsTransform | |
QGraphicsTransform (QObject *parent=0) | |
Constructs a new QGraphicsTransform with the given parent. More... | |
~QGraphicsTransform () | |
Destroys the graphics transform. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Properties | |
qreal | angle |
the angle for clockwise rotation, in degrees. More... | |
QVector3D | axis |
a rotation axis, specified by a vector in 3D space. More... | |
QVector3D | origin |
the origin of the rotation in 3D space. More... | |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Slots inherited from QGraphicsTransform | |
void | update () |
Notifies that this transform operation has changed its parameters in such a way that applyTo() will return a different result than before. More... | |
Protected Functions inherited from QGraphicsTransform | |
QGraphicsTransform (QGraphicsTransformPrivate &p, QObject *parent) | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
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.
Definition at line 122 of file qgraphicstransform.h.
QGraphicsRotation::QGraphicsRotation | ( | QObject * | parent = 0 | ) |
Constructs a new QGraphicsRotation with the given parent.
Definition at line 462 of file qgraphicstransform.cpp.
QGraphicsRotation::~QGraphicsRotation | ( | ) |
qreal QGraphicsRotation::angle | ( | ) | const |
Referenced by setAngle(), and setOrigin().
|
signal |
This signal is emitted whenever the angle has changed.
Referenced by setAngle().
|
virtual |
Reimplemented Function
Implements QGraphicsTransform.
Definition at line 625 of file qgraphicstransform.cpp.
QVector3D QGraphicsRotation::axis | ( | ) | const |
Referenced by setAngle(), and setAxis().
|
signal |
This signal is emitted whenever the axis of the object changes.
Referenced by setAxis().
QVector3D QGraphicsRotation::origin | ( | ) | const |
Referenced by ~QGraphicsRotation().
|
signal |
This signal is emitted whenever the origin has changed.
Referenced by setOrigin().
void QGraphicsRotation::setAngle | ( | qreal | angle | ) |
Definition at line 522 of file qgraphicstransform.cpp.
void QGraphicsRotation::setAxis | ( | const QVector3D & | axis | ) |
Definition at line 574 of file qgraphicstransform.cpp.
Referenced by setAxis().
void QGraphicsRotation::setAxis | ( | Qt::Axis | axis | ) |
Convenience function to set the axis to axis.
Note: the Qt::YAxis rotation for QTransform is inverted from the correct mathematical rotation in 3D space. The QGraphicsRotation class implements a correct mathematical rotation. The following two sequences of code will perform the same transformation:
Definition at line 606 of file qgraphicstransform.cpp.
void QGraphicsRotation::setOrigin | ( | const QVector3D & | point | ) |
Definition at line 491 of file qgraphicstransform.cpp.
|
private |
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.
Definition at line 127 of file qgraphicstransform.h.
|
private |
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.
Definition at line 128 of file qgraphicstransform.h.
|
private |
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).
Definition at line 126 of file qgraphicstransform.h.