fix: close window instead of app

This commit is contained in:
B.Melnik 2021-06-03 11:29:14 +03:00 committed by Iuri Matias
parent 4a407d9204
commit b9c2431ad5
2 changed files with 31 additions and 9 deletions

View File

@ -89,7 +89,7 @@ StatusWindow {
//! Workaround for custom QQuickWindow //! Workaround for custom QQuickWindow
Connections { Connections {
target: c target: applicationWindow
onClosing: { onClosing: {
if (loader.sourceComponent == login) { if (loader.sourceComponent == login) {
applicationWindow.visible = false; applicationWindow.visible = false;
@ -411,12 +411,34 @@ StatusWindow {
} }
MacTrafficLights { MacTrafficLights {
parent: Overlay.overlay // parent: Overlay.overlay
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.margins: 13 anchors.margins: 13
visible: Qt.platform.os === "osx" && !applicationWindow.isFullScreen visible: Qt.platform.os === "osx" && !applicationWindow.isFullScreen
onClose: {
if (loader.sourceComponent == login ||
loader.sourceComponent == intro) {
applicationWindow.visible = false;
}
else if (loader.sourceComponent == app) {
if (loader.item.appSettings.quitOnClose) {
Qt.quit();
} else {
applicationWindow.visible = false;
}
}
}
onMinimised: {
applicationWindow.showMinimized()
}
onMaximized: {
applicationWindow.toggleFullScreen()
}
} }
} }

View File

@ -5,6 +5,10 @@ import "../imports"
MouseArea { MouseArea {
id: statusMacWindowButtons id: statusMacWindowButtons
signal close()
signal minimised()
signal maximized()
hoverEnabled: true hoverEnabled: true
width: layout.implicitWidth width: layout.implicitWidth
@ -15,10 +19,6 @@ MouseArea {
readonly property color inactiveBorder: Style.current.name === Constants.lightThemeName ? "#10000000" readonly property color inactiveBorder: Style.current.name === Constants.lightThemeName ? "#10000000"
: "#10FFFFFF" : "#10FFFFFF"
Row { Row {
id: layout id: layout
spacing: 8 spacing: 8
@ -48,7 +48,7 @@ MouseArea {
id: closeSensor id: closeSensor
anchors.fill: parent anchors.fill: parent
onClicked: applicationWindow.close() onClicked: statusMacWindowButtons.close()
} }
} }
@ -77,7 +77,7 @@ MouseArea {
id: miniSensor id: miniSensor
anchors.fill: parent anchors.fill: parent
onClicked: applicationWindow.showMinimized() onClicked: statusMacWindowButtons.minimised()
} }
} }
@ -105,7 +105,7 @@ MouseArea {
id: maxiSensor id: maxiSensor
anchors.fill: parent anchors.fill: parent
onClicked: applicationWindow.toggleFullScreen() onClicked: statusMacWindowButtons.maximized()
} }
} }
} }