您的位置:首页 > 其它

qml 程序退出确认对话框

2016-06-13 12:09 363 查看
MessageDialog
{
id:myMsgbox
standardButtons: StandardButton.Yes | StandardButton.No
modality: Qt.ApplicationModal
title: "确认退出"
text:"你确定要退出商旅平台吗?"
onYes:
    {
Qt.quit();
}
}
StackView {
id: stackView
anchors.fill: parent
focus: true
Keys.onReleased:{
if (event.key === Qt.Key_Back )
{
console.log("key pressed");
console.log("stackView.depth = "+stackView.depth);
if(stackView.depth > 1){
stackView.pop();
event.accepted = true;//消息不再往下传
     }
else
     {
myMsgbox.open();
event.accepted = true;//消息不再往下传
     }
}
}
initialItem: {
Qt.resolvedUrl("qrc:///qml/UserInfo/QLogin.qml")
}
}转载:http://blog.163.com/wslngcjsdxdr@126/blog/static/1621962302014817101237288/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: