diff --git a/src/quick/quickstandardtitlebar.cpp b/src/quick/quickstandardtitlebar.cpp index 1b5621e0..d99fa48d 100644 --- a/src/quick/quickstandardtitlebar.cpp +++ b/src/quick/quickstandardtitlebar.cpp @@ -421,10 +421,11 @@ bool QuickStandardTitleBar::mouseEventHandler(QMouseEvent *event) return; } FramelessQuickHelper::get(this)->showSystemMenu([this, button, &scenePos]() -> QPoint { + QPoint pos = scenePos; if (button == Qt::LeftButton) { - return {0, int(std::round(height()))}; + pos = {0, int(std::round(height()))}; } - return scenePos; + return mapToGlobal(pos).toPoint(); }()); }); // Don't eat this event, we have not handled it yet. diff --git a/src/widgets/standardtitlebar.cpp b/src/widgets/standardtitlebar.cpp index 4fcd4d16..52580587 100644 --- a/src/widgets/standardtitlebar.cpp +++ b/src/widgets/standardtitlebar.cpp @@ -343,11 +343,12 @@ bool StandardTitleBarPrivate::mouseEventHandler(QMouseEvent *event) return; } // Please refer to the comments in StandardTitleBarPrivate::setWindowIconVisible(). - FramelessWidgetsHelper::get(m_window)->showSystemMenu([button, q, &scenePos]() -> QPoint { + FramelessWidgetsHelper::get(m_window)->showSystemMenu([button, q, &scenePos, this]() -> QPoint { + QPoint pos = scenePos; if (button == Qt::LeftButton) { - return {0, q->height()}; + pos = {0, q->height()}; } - return scenePos; + return m_window->mapToGlobal(pos); }()); }); // Don't eat this event, we have not handled it yet.