diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-09-03 14:50:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-09-04 08:58:06 +0200 |
commit | b9e3f5955154073ddb87b181f77aa46ae05269df (patch) | |
tree | f276ce3577b76931c82c86d48bf2f921b12d1cd0 /src/widgets/widgets/qmdisubwindow.cpp | |
parent | 0bb2b6213518fdc56181b0ab1d6a6635c324dfc2 (diff) |
QMdiSubWindow: Keep event filter on system menu over its lifetime.
QMdiSubWindow::eventFilter() is supposed to close the sub window on a
double click on the menu icon. However, it did not receive the double
click event since it removed itself when the menu was hidden, which
happened before the double click was delivered.
Task-number: QTBUG-25179
Change-Id: I5e7fb02dda26ceab12e8b7554fc604066a0a3136
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/widgets/widgets/qmdisubwindow.cpp')
-rw-r--r-- | src/widgets/widgets/qmdisubwindow.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 5521d866b2..5166c3cf38 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -1043,6 +1043,7 @@ void QMdiSubWindowPrivate::createSystemMenu() Q_ASSERT_X(q, "QMdiSubWindowPrivate::createSystemMenu", "You can NOT call this function before QMdiSubWindow's ctor"); systemMenu = new QMenu(q); + systemMenu->installEventFilter(q); const QStyle *style = q->style(); addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal())); actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); @@ -2569,7 +2570,6 @@ void QMdiSubWindow::showSystemMenu() // Adjust x() with -menuwidth in reverse mode. if (isRightToLeft()) globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0); - d->systemMenu->installEventFilter(this); d->systemMenu->popup(globalPopupPos); } #endif // QT_NO_MENU @@ -2702,7 +2702,6 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos())); } else if (event->type() == QEvent::Hide) { - d->systemMenu->removeEventFilter(this); d->activeSubControl = QStyle::SC_None; update(QRegion(0, 0, width(), d->titleBarHeight())); } |