fixed crash when enabling 'window always on top'

This commit is contained in:
ch-ems 2018-06-25 15:41:18 +01:00 committed by fourtf
parent 7f5b07a9f9
commit 0245bd5c3a

View file

@ -167,10 +167,12 @@ void BaseWindow::init()
// fourtf: don't ask me why we need to delay this
if (!(this->flags_ & Flags::TopMost)) {
QTimer::singleShot(1, this, [this] {
getApp()->settings->windowTopMost.connect([this](bool topMost, auto) {
::SetWindowPos(HWND(this->winId()), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0,
0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
});
this->connections_.managedConnect(
getApp()->settings->windowTopMost.getValueChangedSignal(),
[this](bool topMost, auto) {
::SetWindowPos(HWND(this->winId()), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0,
0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
});
});
}
#else
@ -178,7 +180,7 @@ void BaseWindow::init()
// this->setWindowFlag(Qt::WindowStaysOnTopHint);
// }
#endif
}
} // namespace widgets
void BaseWindow::setStayInScreenRect(bool value)
{