QtWidgets: Open submenus also on left mouse button press
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 <thor400.75@gmail.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
4762fabce1
commit
afa0e9bf6a
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user