【发布时间】:2018-10-14 19:39:39
【问题描述】:
我花了很长时间才弄清楚我在旋转 QML 对象时遇到的问题,所以我决定分享这个。
问题: 如何动态更新 QML 元素(如图像)的旋转。我知道我可以设置,例如使用转换的旋转(在 MapQuickItem 的示例中):
MapQuickItem
{
sourceItem: Image
{
id: image
anchors.centerIn: parent
source: "image.png"
sourceSize.width: Screen.devicePixelRatio * 256
sourceSize.height: Screen.devicePixelRatio * 256
transform: Rotation {
origin { x: image.sourceSize.width/2;
y: image.sourceSize.height/2;
z: 0}
angle: 0
}
}
}
但是,如何动态更新角度(或transform 的其他部分)?
【问题讨论】: