以下都是个人使用记录,想到哪写到哪,仅供个人使用
1.定义数组
property var titles: [“0”,“1”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”]
2. 定义信号
定义信号:signal notifyback()
发送信号:xxxid.notifyback()
3.阻止点击到下面的页面/控件上去
在所有控件代码的最上面加入:
MouseArea{
anchors.fill: parent
}
说明:在单个子控件也可以使用,这样就能防止点击出子控件
4.加载子页面
(1)加载页面
代码:
Loader{
id: screenLoader
Connections {
target: screenLoader.item
ignoreUnknownSignals: true
onNotifyBackTop:{ //Receive the child QML page’s signal , slot
screenLoader.source = “” //Back to the up QML page
}
onNotifyback:{
screenLoader.source = “”
}
}
}
说明:
ignoreUnknownSignals: true , 表示仅接收下面两个信号,其他信号都忽略
当要加载xxx.qml的子页面时: screenL