Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
fix system menu wrong position
Browse files Browse the repository at this point in the history
Signed-off-by: Yuhang Zhao <zhaoyuhang@rankyee.com>
  • Loading branch information
wangwenx190 committed Apr 7, 2023
1 parent b597d2c commit b4a27c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/quick/quickstandardtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions src/widgets/standardtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b4a27c0

Please sign in to comment.