Skip to content

Commit

Permalink
QMenu: Adjust the position of the submenu
Browse files Browse the repository at this point in the history
When the submenu is about to exceed the screen,
set the position of the submenu to the left border of the main menu

Fixes: QTBUG-104050
Change-Id: I8935f1bfceb93cfa1097391689f4233991394978
Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
Reviewed-by: Richard Moe Gustavsen <[email protected]>
  • Loading branch information
FeiWang1119 committed Jun 13, 2022
1 parent e35fc90 commit e57ab1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/widgets/widgets/qmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3579,7 +3579,7 @@ void QMenu::internalDelayedPopup()
const QRect actionRect(d->actionRect(d->currentAction));
QPoint subMenuPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
if (subMenuPos.x() > screen.right())
subMenuPos.setX(QCursor::pos().x());
subMenuPos.setX(geometry().left());

const auto &subMenuActions = d->activeMenu->actions();
if (!subMenuActions.isEmpty()) {
Expand Down

0 comments on commit e57ab1b

Please sign in to comment.