Rotation QML Type
Bietet eine Möglichkeit, ein Item zu drehen. Mehr...
Import Statement: | import QtQuick |
Eigenschaften
Detaillierte Beschreibung
Der Typ Rotation ermöglicht es, eine Item durch eine Transformation vom Typ Rotation zu drehen.
Er ermöglicht die Rotation (z-Achse) relativ zu einem beliebigen Punkt und bietet außerdem eine Möglichkeit, 3D-ähnliche Rotationen für Elemente anzugeben. Dies gibt mehr Kontrolle über die Elementrotation als die rotation Eigenschaft.
Im folgenden Beispiel wird ein Rechteck um seinen inneren Punkt (25, 25) gedreht:
Rectangle { width: 100; height: 100 color: "blue" transform: Rotation { origin.x: 25; origin.y: 25; angle: 45} }
Für 3D-ähnliche Elementdrehungen müssen Sie zusätzlich zum Ursprungspunkt die Drehachse angeben. Das folgende Beispiel zeigt verschiedene 3D-ähnliche Drehungen, die auf ein Image angewendet werden.
import QtQuick Row { x: 10; y: 10 spacing: 10 Image { source: "pics/qt.png" } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 18 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 36 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 54 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 72 } } }
Siehe auch Dial Control Beispiel und Qt Quick Demo - Clocks.
Eigenschaft Dokumentation
angle : real |
Der Winkel, um den gedreht werden soll, in Grad im Uhrzeigersinn.
Die Achse, um die gedreht werden soll. Für eine einfache (2D) Drehung um einen Punkt müssen Sie keine Achse angeben, da die Standardachse die z-Achse ist (axis { x: 0; y: 0; z: 1 }
).
Bei einer typischen 3D-ähnlichen Drehung geben Sie normalerweise sowohl den Ursprung als auch die Achse an.
Der Ursprungspunkt der Drehung (d. h. der Punkt, der relativ zum übergeordneten Element fixiert bleibt, während sich der Rest des Elements dreht). Standardmäßig ist der Ursprung (0, 0).
© 2025 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.