QTransform Class▲
-
Header: QTransform
-
Since: Qt 5.6
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS 3dcore)
target_link_libraries(mytarget PRIVATE Qt6::3dcore)
-
qmake: QT += 3dcore
-
Inherited By:
-
Instantiated By: qml-qt3d-core-transform.xml
-
Inherits: Qt3DCore::QComponent
Detailed Description▲
The QTransform component is not shareable between multiple QEntity's. The transformation is held as QVector3D scale, QQuaternion rotation and QVector3D translation components. The transformations are applied to the mesh in that order. When QTransform::matrix property is set, it is decomposed to these transform components and corresponding signals are emitted.
Several helper functions are provided to set up the QTransform; fromAxisAndAngle and fromAxesAndAngles can be used to set the rotation around specific axes, fromEulerAngles can be used to set the rotation based on euler angles and rotateAround can be used to rotate the object around specific point relative to local origin.
Property Documentation▲
matrix : QMatrix4x4▲
Holds the QMatrix4x4 of the transform.
When the matrix property is set, it is decomposed to translation, rotation and scale components.
Access functions:
-
matrix() const
-
void setMatrix(const &matrix)
Notifier signal:
-
void matrixChanged()
rotation : QQuaternion▲
Holds the rotation of the transform as QQuaternion.
Access functions:
-
rotation() const
-
void setRotation(const &rotation)
Notifier signal:
-
void rotationChanged(const &rotation)
rotationX : float▲
Holds the x rotation of the transform as Euler angle.
Access functions:
-
float rotationX() const
-
void setRotationX(float rotationX)
Notifier signal:
-
void rotationXChanged(float rotationX)
rotationY : float▲
Holds the y rotation of the transform as Euler angle.
Access functions:
-
float rotationY() const
-
void setRotationY(float rotationY)
Notifier signal:
-
void rotationYChanged(float rotationY)
rotationZ : float▲
Holds the z rotation of the transform as Euler angle.
Access functions:
-
float rotationZ() const
-
void setRotationZ(float rotationZ)
Notifier signal:
-
void rotationZChanged(float rotationZ)
scale : float▲
Holds the uniform scale of the transform. If the scale has been set with setScale3D, holds the x value only.
Access functions:
-
float scale() const
-
void setScale(float scale)
Notifier signal:
-
void scaleChanged(float scale)
scale3D : QVector3D▲
Holds the scale of the transform as QVector3D.
Access functions:
-
scale3D() const
-
void setScale3D(const &scale)
Notifier signal:
-
void scale3DChanged(const &scale)
translation : QVector3D▲
Holds the translation of the transform as QVector3D.
Access functions:
-
translation() const
-
void setTranslation(const &translation)
Notifier signal:
-
void translationChanged(const &translation)
[read-only, since 5.14] worldMatrix : const QMatrix4x4▲
Holds the world transformation matrix for the transform. This assumes the QTransform component is being referenced by a QEntity. This makes it more convenient to identify when a QEntity part of a subtree has been transformed in the world even though its local transformation might not have changed.
This property was introduced in Qt 5.14.
Access functions:
-
worldMatrix() const
Notifier signal:
-
void worldMatrixChanged(const &worldMatrix)
Member Function Documentation▲
[explicit] QTransform::QTransform(Qt3DCore::QNode *parent = nullptr)▲
Constructs a new QTransform with parent.
[static, since 5.11] QQuaternion QTransform::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)▲
Creates a QQuaterniom definining a rotation from the axes xAxis, yAxis and zAxis.
This function was introduced in Qt 5.11.
[static] QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2)▲
Creates a QQuaternion from axis1, angle1, axis2, and angle2. Returns the resulting QQuaternion.
[static] QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2, const QVector3D &axis3, float angle3)▲
Creates a QQuaternion from axis1, angle1, axis2, angle2, axis3, and angle3. Returns the resulting QQuaternion.
[static] QQuaternion QTransform::fromAxisAndAngle(const QVector3D &axis, float angle)▲
Creates a QQuaternion from axis and angle. Returns the resulting QQuaternion.
[static] QQuaternion QTransform::fromAxisAndAngle(float x, float y, float z, float angle)▲
Creates a QQuaternion from x, y, z, and angle. Returns the resulting QQuaternion.
[static] QQuaternion QTransform::fromEulerAngles(const QVector3D &eulerAngles)▲
Creates a QQuaternion from eulerAngles. Returns the resulting QQuaternion.
[static] QQuaternion QTransform::fromEulerAngles(float pitch, float yaw, float roll)▲
Creates a QQuaternion from pitch, yaw, and roll. Returns the resulting QQuaternion.
[static] QMatrix4x4 QTransform::rotateAround(const QVector3D &point, float angle, const QVector3D &axis)▲
Creates a rotation matrix from axis and angle around point. Returns the resulting QMatrix4x4.
[static, since 5.11] QMatrix4x4 QTransform::rotateFromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)▲
Returns a rotation matrix defined from the axes xAxis, yAxis, zAxis.
This function was introduced in Qt 5.11.
[since 5.14] QMatrix4x4 QTransform::worldMatrix() const▲
Returns the world transformation matrix associated to the QTransform when referenced by a QEntity which may be part of a QEntity hierarchy.
Getter function for property worldMatrix.
This function was introduced in Qt 5.14.