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: I323d7ba206352a5d533584543b9a2ebf842b4dfc
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Leonard Lee 2013-06-12 11:26:53 +02:00 committed by The Qt Project
parent 3ac5499a9e
commit f730cd7542

View File

@ -2854,9 +2854,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;