Rotation QML Type
アイテムを回転させる方法を提供します。詳細...
| Import Statement: | import QtQuick |
プロパティ
- angle : real
- axis
- distanceToPlane : real
(since 6.11) - origin
詳細な説明
Rotation タイプは、Item を回転型トランスフォームによって回転させる方法を提供します。
これにより、任意の点を基準とした(Z軸)回転が可能になり、アイテムに対して3Dのような回転を指定する方法も提供されます。これにより、rotation プロパティよりも、アイテムの回転をより細かく制御できるようになります。
次の例では、Rectangleをその内部の点(25, 25)を中心に回転させています:
Rectangle {
width: 100; height: 100
color: "blue"
transform: Rotation { origin.x: 25; origin.y: 25; angle: 45}
}3D風のアイテムの回転を行うには、原点に加えて回転軸も指定する必要があります。次の例は、Image に適用されたさまざまな3D風の回転を示しています。
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 }
}
}
「ダイアル コントロールの例」および「Qt Quick デモ - 時計」も参照してください 。
プロパティのドキュメント
angle : real
回転させる角度(度単位、時計回り)。
axis group
回転の軸。点を中心とする単純な(2D)回転の場合、デフォルトの軸はz軸(axis { x: 0; y: 0; z: 1 } )であるため、軸を指定する必要はありません。
一般的な3Dのような回転を行う場合は、通常、原点と軸の両方を指定します。

distanceToPlane : real [since 6.11]
このプロパティは、透視投影モデルにおける視平面(仮想画面)と観察者との間の距離を定義します。
距離を小さくすると遠近感が強まり、回転時にオブジェクトがより劇的に後退または前進しているように見えます。値を大きくすると、遠近感の歪みが目立ちにくくなり、より平坦で正投影に近い外観になります。
デフォルト値は `1024.0` で、これはほとんどのユースケースに適した適度な遠近感を提供します。
このプロパティが `0` に設定されている場合、透視投影は適用されません。この場合、回転は `QMatrix4x4::rotate()` で定義された変換を使用して、3D 空間で直接実行されます。
このプロパティは、x軸およびy軸周りの回転にのみ影響します。z軸周りの回転(2D回転)は、このプロパティの影響を受けません。
このプロパティは Qt 6.11 で導入されました。
origin group
回転の原点(つまり、アイテムの他の部分が回転しても、親要素に対して固定されたままの点)。デフォルトでは、原点は (0, 0) です。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.