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