allowing hotswapping the top-most setting on windows

This commit is contained in:
fourtf 2018-05-23 12:31:03 +02:00
parent 67e580059c
commit eb25e863e3
2 changed files with 11 additions and 0 deletions

View file

@ -115,9 +115,16 @@ void BaseWindow::init()
} }
#endif #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()) { if (app->settings->windowTopMost.getValue()) {
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
} }
#endif
} }
void BaseWindow::setStayInScreenRect(bool value) void BaseWindow::setStayInScreenRect(bool value)

View file

@ -8,7 +8,11 @@
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
#ifdef USEWINSDK
#define WINDOW_TOPMOST "Window always on top"
#else
#define WINDOW_TOPMOST "Window always on top (requires restart)" #define WINDOW_TOPMOST "Window always on top (requires restart)"
#endif
#define INPUT_EMPTY "Hide input box when empty" #define INPUT_EMPTY "Hide input box when empty"
#define PAUSE_HOVERING "When hovering" #define PAUSE_HOVERING "When hovering"