diff --git a/app/qml/main.qml b/app/qml/main.qml index 9788380..94c5caa 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -173,6 +173,7 @@ ApplicationWindow{ } } onClosing: { + root.closeWindow() // OSX Since we are currently supporting only one window // quit the application when it is closed. //if (Qt.platform.os === "osx") diff --git a/app/qml/root.qml b/app/qml/root.qml index bd279d9..56dc32f 100644 --- a/app/qml/root.qml +++ b/app/qml/root.qml @@ -21,13 +21,23 @@ import QtQuick 2.2 import QtQuick.Window 2.1 QtObject { - id: root + id: root + property int terminalCount + function newWindow() { var component = Qt.createComponent("main.qml") var window = component.createObject() window.show() + terminalCount = terminalCount + 1 } - Component.onCompleted: { + function closeWindow() { + terminalCount = terminalCount - 1 + if (terminalCount == 0) { + Qt.quit() + } + } + Component.onCompleted: { + terminalCount = 0 root.newWindow() } }