![f01aab4322f23e388572928b353120a3.png](https://img-blog.csdnimg.cn/img_convert/f01aab4322f23e388572928b353120a3.png)
属性
QML中元素使用它们的元素类型名进行声明,使用它们的属性或者创建自定义属性来定义。一个属性对应一个值,以Text元素为例:
import QtQuick 2.3import QtQuick.Window 2.2Window { visible: true width: 640 height: 480 Text { id: thisLabel; x: 24; y: 16 height: 2 * width property int times: 24 property alias anotherTimes: thisLabel.times text: "Say hello " + times font.family: "sans-serif" font.pixelSize: 24 KeyNavigation.tab: otherLabel onHeightChanged: console.log('height: ', height) focus: true color: focus ? "red" : "black" } Text { id: otherLabel; x: 24; y: 50 height: 2 * width