diff --git a/lib/appbase/widgets/BaseWindow.cpp b/lib/appbase/widgets/BaseWindow.cpp index 4f0ec2537..8f77d6585 100644 --- a/lib/appbase/widgets/BaseWindow.cpp +++ b/lib/appbase/widgets/BaseWindow.cpp @@ -77,6 +77,12 @@ BaseWindow::BaseWindow(QWidget *parent, Flags _flags) // QTimer::this->scaleChangedEvent(this->getScale()); this->resize(300, 150); + +#ifdef USEWINSDK + this->useNextBounds_.setSingleShot(true); + QObject::connect(&this->useNextBounds_, &QTimer::timeout, this, + [this]() { this->currentBounds_ = this->nextBounds_; }); +#endif } void BaseWindow::setInitialBounds(const QRect &bounds) @@ -809,8 +815,10 @@ bool BaseWindow::handleSIZE(MSG *msg) { this->ui_.windowLayout->setContentsMargins(0, 1, 0, 0); } - if ((this->isNotMinimizedOrMaximized_ = - msg->wParam == SIZE_RESTORED)) + + this->isNotMinimizedOrMaximized_ = msg->wParam == SIZE_RESTORED; + + if (this->isNotMinimizedOrMaximized_) { RECT rect; ::GetWindowRect(msg->hwnd, &rect); @@ -818,6 +826,7 @@ bool BaseWindow::handleSIZE(MSG *msg) QRect(QPoint(rect.left, rect.top), QPoint(rect.right - 1, rect.bottom - 1)); } + this->useNextBounds_.stop(); } } return false; @@ -833,8 +842,10 @@ bool BaseWindow::handleMOVE(MSG *msg) { RECT rect; ::GetWindowRect(msg->hwnd, &rect); - this->currentBounds_ = QRect(QPoint(rect.left, rect.top), - QPoint(rect.right - 1, rect.bottom - 1)); + this->nextBounds_ = QRect(QPoint(rect.left, rect.top), + QPoint(rect.right - 1, rect.bottom - 1)); + + this->useNextBounds_.start(10); } #endif return false; diff --git a/lib/appbase/widgets/BaseWindow.hpp b/lib/appbase/widgets/BaseWindow.hpp index 4f56204c7..a54a3ba80 100644 --- a/lib/appbase/widgets/BaseWindow.hpp +++ b/lib/appbase/widgets/BaseWindow.hpp @@ -123,6 +123,8 @@ private: #ifdef USEWINSDK QRect initalBounds_; QRect currentBounds_; + QRect nextBounds_; + QTimer useNextBounds_; bool isNotMinimizedOrMaximized_{}; #endif