Prevent interaction with a disabled menu in the menubar

When moving the mouse over a disabled menu it could appear to be usable
but it should not show any interaction at all.

Task-number: QTBUG-31688
Task-number: QTBUG-37488
Change-Id: I9e6594b40e8b209146d8c3705750dfd75f1258c5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Andy Shaw 2014-04-07 19:13:59 +02:00 committed by The Qt Project
parent feca69e89f
commit d36002d046

View File

@ -384,7 +384,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat
QAction *previousAction = currentAction;
#endif
currentAction = action;
if (action) {
if (action && action->isEnabled()) {
activateAction(action, QAction::Hover);
if(popup)
popupAction(action, activateFirst);
@ -1038,7 +1038,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
d->mouseDown = true;
QAction *action = d->actionAt(e->pos());
if (!action || !d->isVisible(action)) {
if (!action || !d->isVisible(action) || !action->isEnabled()) {
d->setCurrentAction(0);
#ifndef QT_NO_WHATSTHIS
if (QWhatsThis::inWhatsThisMode())