From eb25e863e3146cf83d4f7b8930b9c14e7f69a760 Mon Sep 17 00:00:00 2001 From: fourtf Date: Wed, 23 May 2018 12:31:03 +0200 Subject: [PATCH] allowing hotswapping the top-most setting on windows --- src/widgets/basewindow.cpp | 7 +++++++ src/widgets/settingspages/behaviourpage.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/widgets/basewindow.cpp b/src/widgets/basewindow.cpp index 65408b5de..7682c06b8 100644 --- a/src/widgets/basewindow.cpp +++ b/src/widgets/basewindow.cpp @@ -115,9 +115,16 @@ void BaseWindow::init() } #endif +#ifdef USEWINSDK + app->settings->windowTopMost.connect([this](bool topMost, auto) { + ::SetWindowPos((HWND)this->winId(), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE); + }); +#else if (app->settings->windowTopMost.getValue()) { this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); } +#endif } void BaseWindow::setStayInScreenRect(bool value) diff --git a/src/widgets/settingspages/behaviourpage.cpp b/src/widgets/settingspages/behaviourpage.cpp index e251d9ad5..68ea46ef4 100644 --- a/src/widgets/settingspages/behaviourpage.cpp +++ b/src/widgets/settingspages/behaviourpage.cpp @@ -8,7 +8,11 @@ #include #include +#ifdef USEWINSDK +#define WINDOW_TOPMOST "Window always on top" +#else #define WINDOW_TOPMOST "Window always on top (requires restart)" +#endif #define INPUT_EMPTY "Hide input box when empty" #define PAUSE_HOVERING "When hovering"