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,11 +2697,16 @@ QMenu::event(QEvent *e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case QEvent::ContextMenu:
|
case QEvent::MouseButtonPress:
|
||||||
if (d->delayState.timer.isActive()) {
|
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();
|
d->delayState.stop();
|
||||||
internalDelayedPopup();
|
internalDelayedPopup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case QEvent::Resize: {
|
case QEvent::Resize: {
|
||||||
QStyleHintReturnMask menuMask;
|
QStyleHintReturnMask menuMask;
|
||||||
|
Loading…
Reference in New Issue
Block a user