From 2a7f1605348cfeca6def8e0f336d174bd7c13eb1 Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Thu, 15 Dec 2016 00:59:10 +0000 Subject: [PATCH] Settings hide/show window after changing decorations type --- main.qml | 17 +++++++++++++++++ pages/Settings.qml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/main.qml b/main.qml index f6be732e..39826ab8 100644 --- a/main.qml +++ b/main.qml @@ -628,6 +628,23 @@ ApplicationWindow { flags: persistentSettings.customDecorations ? (Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint) : (Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint) onWidthChanged: x -= 0 + function setCustomWindowDecorations(custom) { + var x = appWindow.x + var y = appWindow.y + if (x < 0) + x = 0 + if (y < 0) + y = 0 + persistentSettings.customDecorations = custom + if (custom) + appWindow.flags = Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint + else + appWindow.flags = Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint + appWindow.hide() + appWindow.x = x + appWindow.y = y + appWindow.show() + } Component.onCompleted: { x = (Screen.width - width) / 2 diff --git a/pages/Settings.qml b/pages/Settings.qml index 155cc5f3..649242d6 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -338,7 +338,7 @@ Rectangle { CheckBox { id: customDecorationsCheckBox checked: persistentSettings.customDecorations - onClicked: persistentSettings.customDecorations = checked + onClicked: appWindow.setCustomWindowDecorations(checked) text: qsTr("Custom decorations") + translationManager.emptyString checkedIcon: "../images/checkedVioletIcon.png" uncheckedIcon: "../images/uncheckedIcon.png"