QtBase  v6.3.1
Signals | Public Member Functions | Properties | List of all members
QGraphicsRotation Class Reference

The QGraphicsRotation class provides a rotation transformation around a given axis. More...

#include <qgraphicstransform.h>

Inheritance diagram for QGraphicsRotation:
Inheritance graph
[legend]
Collaboration diagram for QGraphicsRotation:
Collaboration graph
[legend]

Signals

void originChanged ()
 
void angleChanged ()
 
void axisChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 

Public Member Functions

 QGraphicsRotation (QObject *parent=nullptr)
 
 ~QGraphicsRotation ()
 
QVector3D origin () const
 
void setOrigin (const QVector3D &point)
 
qreal angle () const
 
void setAngle (qreal)
 
QVector3D axis () const
 
void setAxis (const QVector3D &axis)
 
void setAxis (Qt::Axis axis)
 
void applyTo (QMatrix4x4 *matrix) const override
 
- Public Member Functions inherited from QGraphicsTransform
 QGraphicsTransform (QObject *parent=nullptr)
 
 ~QGraphicsTransform ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 
virtual ~QObject ()
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const noexcept
 
bool blockSignals (bool b) noexcept
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 
template<typename T >
T findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
const QObjectListchildren () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Properties

QVector3D origin
 the origin of the rotation in 3D space. More...
 
qreal angle
 the angle for clockwise rotation, in degrees. More...
 
QVector3D axis
 a rotation axis, specified by a vector in 3D space. More...
 
- Properties inherited from QObject
QString objectName
 the name of this object More...
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Slots inherited from QGraphicsTransform
void update ()
 
- Protected Member Functions inherited from QGraphicsTransform
 QGraphicsTransform (QGraphicsTransformPrivate &p, QObject *parent)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

The QGraphicsRotation class provides a rotation transformation around a given axis.

Since
4.6 \inmodule QtWidgets

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(), QTransform::rotate()

Definition at line 118 of file qgraphicstransform.h.

Constructor & Destructor Documentation

◆ QGraphicsRotation()

QGraphicsRotation::QGraphicsRotation ( QObject parent = nullptr)

Constructs a new QGraphicsRotation with the given parent.

Definition at line 431 of file qgraphicstransform.cpp.

◆ ~QGraphicsRotation()

QGraphicsRotation::~QGraphicsRotation ( )

Destroys the graphics rotation.

Definition at line 439 of file qgraphicstransform.cpp.

Member Function Documentation

◆ angle()

qreal QGraphicsRotation::angle ( ) const

Definition at line 480 of file qgraphicstransform.cpp.

◆ angleChanged

void QGraphicsRotation::angleChanged ( )
signal

This signal is emitted whenever the angle has changed.

See also
QGraphicsRotation::angle
Here is the caller graph for this function:

◆ applyTo()

void QGraphicsRotation::applyTo ( QMatrix4x4 matrix) const
overridevirtual

\reimp

Implements QGraphicsTransform.

Definition at line 576 of file qgraphicstransform.cpp.

Here is the call graph for this function:

◆ axis()

QVector3D QGraphicsRotation::axis ( ) const

Definition at line 523 of file qgraphicstransform.cpp.

◆ axisChanged

void QGraphicsRotation::axisChanged ( )
signal

This signal is emitted whenever the axis of the object changes.

See also
QGraphicsRotation::axis
Here is the caller graph for this function:

◆ origin()

QVector3D QGraphicsRotation::origin ( ) const

Definition at line 452 of file qgraphicstransform.cpp.

◆ originChanged

QGraphicsRotation::originChanged ( )
signal

This signal is emitted whenever the origin has changed.

See also
QGraphicsRotation::origin
Here is the caller graph for this function:

◆ setAngle()

void QGraphicsRotation::setAngle ( qreal  angle)

Definition at line 485 of file qgraphicstransform.cpp.

Here is the call graph for this function:

◆ setAxis() [1/2]

void QGraphicsRotation::setAxis ( const QVector3D axis)

Definition at line 528 of file qgraphicstransform.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAxis() [2/2]

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:

t.rotate(45, Qt::YAxis);
r.setAxis(Qt::YAxis);
r.setAngle(-45);
The QGraphicsRotation class provides a rotation transformation around a given axis.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:56
@ YAxis
Definition: qnamespace.h:1356
GLboolean r
[2]
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243

Definition at line 557 of file qgraphicstransform.cpp.

Here is the call graph for this function:

◆ setOrigin()

void QGraphicsRotation::setOrigin ( const QVector3D point)

Definition at line 457 of file qgraphicstransform.cpp.

Here is the call graph for this function:

Property Documentation

◆ angle

QGraphicsRotation::angle
readwrite

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.

See also
origin

Definition at line 110 of file qgraphicstransform.h.

◆ axis

QGraphicsRotation::axis
readwrite

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.

See also
QTransform, QGraphicsRotation::angle

Definition at line 110 of file qgraphicstransform.h.

◆ origin

QGraphicsRotation::origin
readwrite

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).

See also
angle

Definition at line 110 of file qgraphicstransform.h.


The documentation for this class was generated from the following files: