このページでは

Rotation QML Type

アイテムを回転させる方法を提供します。詳細...

Import Statement: import QtQuick

プロパティ

詳細説明

Rotation タイプは、回転タイプの変換によってItem を回転させる方法を提供します。

また、Item の 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 }
    }
}

Dial Control の例およびQt Quick Demo - Clocksも参照してください

プロパティのドキュメント

angle : real

回転させる角度を時計回りで指定する。

axis group

axis.x : real

axis.y : real

axis.z : real

回転させる軸。点を中心とした単純な(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

origin.x : real

origin.y : real

回転の原点(つまり、アイテムの残りの部分が回転しても、親に対して固定されたままの点)。デフォルトでは原点は (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.