From b20cb63f457930651cf7aa9108df5432e25dcc46 Mon Sep 17 00:00:00 2001 From: Leonard Lee Date: Mon, 17 Jun 2013 10:47:06 +0200 Subject: Recognize separator item in QMenu. The mouse over event on upper level menu separator should automatically close the sub menu listing. Manual test is not needed for this commit since it is easy to test it against common examples. Task-number: QTBUG-31664 Change-Id: I6632d0bce27ca064ddfdd05743df969b3e6e02ee (cherry-picked from qtbase/f730cd7542548d7d5fb7cd25f631e471697960c8) Reviewed-by: J-P Nurmi --- src/gui/widgets/qmenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 400fd30..db3d7cd 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -2863,9 +2863,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) d->hasHadMouse = d->hasHadMouse || rect().contains(e->pos()); QAction *action = d->actionAt(e->pos()); - if (!action) { + if (!action || action->isSeparator()) { if (d->hasHadMouse - && (!d->currentAction + && (!d->currentAction || (action && action->isSeparator()) || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; -- cgit v0.12