- Qt 6.11
- Qt Quick
- QML Types
- Rotation
- Qt 6.11.1 Reference Documentation

# Rotation QML Type

Provides a way to rotate an Item. More...

Import Statement: | `import QtQuick`

- List of all members, including inherited members

## Properties

- angle : real
- axis
  - axis.x : real
  - axis.y : real
  - axis.z : real
- distanceToPlane : real `(since 6.11)`
- origin
  - origin.x : real
  - origin.y : real

## Detailed Description

The Rotation type provides a way to rotate an Item through a rotation-type transform.

It allows (z axis) rotation to be relative to an arbitrary point, and also provides a way to specify 3D-like rotations for Items. This gives more control over item rotation than the rotation property.

The following example rotates a Rectangle around its interior point (25, 25):

     Rectangle {
         width: 100; height: 100
         color: "blue"
         transform: Rotation { origin.x: 25; origin.y: 25; angle: 45}
     }

For 3D-like item rotations, you must specify the axis of rotation in addition to the origin point. The following example shows various 3D-like rotations applied to an Image.

     import QtQuick

     Row {
         x: 10; y: 10
         spacing: 10

         Image { source: "images/qt-logo.png" }
         Image {
             source: "images/qt-logo.png"
             transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 18 }
         }
         Image {
             source: "images/qt-logo.png"
             transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 36 }
         }
         Image {
             source: "images/qt-logo.png"
             transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 54 }
         }
         Image {
             source: "images/qt-logo.png"
             transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 72 }
         }
     }

See also Dial Control example and Qt Quick Demo - Clocks.

## Property Documentation

### angle : real

The angle to rotate, in degrees clockwise.

### axis group

### axis.x : real

### axis.y : real

### axis.z : real

The axis to rotate around. For simple (2D) rotation around a point, you do not need to specify an axis, as the default axis is the z axis (`axis { x: 0; y: 0; z: 1 }`).

For a typical 3D-like rotation you will usually specify both the origin and the axis.

### distanceToPlane : real `[since 6.11]`

This property defines the distance between the view plane (the virtual screen) and the observer in the perspective projection model.

A smaller distance produces a stronger perspective effect, making the object appear to recede or advance more dramatically during rotation. A larger value results in a flatter, more orthographic appearance with less visible perspective distortion.

The default value is `1024.0`, which provides a moderate perspective suitable for most use cases.

When this property is set to `0`, no perspective projection is applied. In this case, the rotation is performed directly in 3D space using the transformation defined by QMatrix4x4::rotate().

This property only affects rotations around the x and y axes. Rotations around the z axis (2D rotations) are not influenced by this property.

This property was introduced in Qt 6.11.

### origin group

### origin.x : real

### origin.y : real

The origin point of the rotation (i.e., the point that stays fixed relative to the parent as the rest of the item rotates). By default the origin is (0, 0).