count child terminals, qt.quit when none left
This commit is contained in:
parent
10fd2a11ee
commit
52140c4c45
@ -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")
|
||||
|
@ -22,12 +22,22 @@ import QtQuick.Window 2.1
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
property int terminalCount
|
||||
|
||||
function newWindow() {
|
||||
var component = Qt.createComponent("main.qml")
|
||||
var window = component.createObject()
|
||||
window.show()
|
||||
terminalCount = terminalCount + 1
|
||||
}
|
||||
function closeWindow() {
|
||||
terminalCount = terminalCount - 1
|
||||
if (terminalCount == 0) {
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
terminalCount = 0
|
||||
root.newWindow()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user