Translate QML Type
提供了一种在不改变项的 x 或 y 属性的情况下移动该项的方法。更多...
| Import Statement: | import QtQuick |
属性
详细说明
“Translate”类型除了支持“Item”的 x 和 y 属性外,还提供了对位置的独立控制。
以下示例移动了Rectangle 项的Y轴位置,同时仍允许Row 像未经过变换一样对这些项进行布局:
import QtQuick 2.0
Row {
Rectangle {
width: 100; height: 100
color: "blue"
transform: Translate { y: 20 }
}
Rectangle {
width: 100; height: 100
color: "red"
transform: Translate { y: -20 }
}
}
属性文档
x : real
沿 X 轴的平移。
默认值为 0.0。
y : real
沿 Y 轴的平移。
默认值为 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.