Browse Source

Attach close event to main window to catch unsaved files when exit

application.
cl-refactor
yann300 10 years ago
parent
commit
64220f9eda
  1. 1
      mix/qml/MainContent.qml
  2. 23
      mix/qml/main.qml

1
mix/qml/MainContent.qml

@ -175,7 +175,6 @@ Rectangle {
Layout.fillHeight: true
Connections {
target: projectModel.codeEditor
}
}

23
mix/qml/main.qml

@ -17,6 +17,25 @@ ApplicationWindow {
minimumHeight: 300
title: qsTr("Mix")
Connections
{
target: mainApplication
onClosing:
{
mainApplication.close();
close.accepted = false;
}
}
function close()
{
projectModel.appIsClosing = true;
if (projectModel.projectPath !== "")
projectModel.closeProject(function() { Qt.quit(); })
else
Qt.quit();
}
menuBar: MenuBar {
Menu {
title: qsTr("File")
@ -95,9 +114,7 @@ ApplicationWindow {
shortcut: "Ctrl+Q"
onTriggered:
{
projectModel.appIsClosing = true;
if (projectModel.projectPath !== "")
projectModel.closeProject(function() { Qt.quit(); })
mainApplication.close();
}
}

Loading…
Cancel
Save