import的别名引用
- 使用as引用,将
import QtQuick.Window 2.0 as My
的QtQuick.Window 2.0
别名为My
引用.
属性的别名引用
- 使用alias别名引用,将
property alias rectWidth: rect.width
的rect.width
别名为rectWidth
引用.
例子
import QtQuick 2.5
import QtQuick.Window 2.0 as My
My.Window {
property alias rectWidth: rect.width
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle {
id: rect
width: 100; height: 200
color: "red"
}
}