count child terminals, qt.quit when none left
This commit is contained in:
parent
10fd2a11ee
commit
52140c4c45
@ -173,6 +173,7 @@ ApplicationWindow{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClosing: {
|
onClosing: {
|
||||||
|
root.closeWindow()
|
||||||
// OSX Since we are currently supporting only one window
|
// OSX Since we are currently supporting only one window
|
||||||
// quit the application when it is closed.
|
// quit the application when it is closed.
|
||||||
//if (Qt.platform.os === "osx")
|
//if (Qt.platform.os === "osx")
|
||||||
|
@ -22,12 +22,22 @@ import QtQuick.Window 2.1
|
|||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
property int terminalCount
|
||||||
|
|
||||||
function newWindow() {
|
function newWindow() {
|
||||||
var component = Qt.createComponent("main.qml")
|
var component = Qt.createComponent("main.qml")
|
||||||
var window = component.createObject()
|
var window = component.createObject()
|
||||||
window.show()
|
window.show()
|
||||||
|
terminalCount = terminalCount + 1
|
||||||
}
|
}
|
||||||
|
function closeWindow() {
|
||||||
|
terminalCount = terminalCount - 1
|
||||||
|
if (terminalCount == 0) {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
terminalCount = 0
|
||||||
root.newWindow()
|
root.newWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user