Skip to content

Commit

Permalink
QtWidgets: Open submenus also on left mouse button press
Browse files Browse the repository at this point in the history
This patch allows to open submenus also on left mouse button press.

Previously submenus could be opened only on right mouse button press
as ContextMenu event which was inconvenient especially for long submenu
popup timeout.

Task-number: QTBUG-53054
Change-Id: I1bd78ed4436f738c8838f7f4687ffebb94b66725
Reviewed-by: Félix Bourbonnais <[email protected]>
Reviewed-by: Gabriel de Dietrich <[email protected]>
Reviewed-by: Shawn Rutledge <[email protected]>
  • Loading branch information
zaps166 committed Jun 8, 2016
1 parent 4762fab commit afa0e9b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/widgets/widgets/qmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2697,10 +2697,15 @@ QMenu::event(QEvent *e)
return true;
}
} break;
case QEvent::ContextMenu:
if (d->delayState.timer.isActive()) {
d->delayState.stop();
internalDelayedPopup();
case QEvent::MouseButtonPress:
case QEvent::ContextMenu: {
bool canPopup = true;
if (e->type() == QEvent::MouseButtonPress)
canPopup = (static_cast<QMouseEvent*>(e)->button() == Qt::LeftButton);
if (canPopup && d->delayState.timer.isActive()) {
d->delayState.stop();
internalDelayedPopup();
}
}
break;
case QEvent::Resize: {
Expand Down

0 comments on commit afa0e9b

Please sign in to comment.