From 1279045ab270cdd34af0a41aa7642593aa93d19b Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Fri, 21 Sep 2012 10:09:30 +0200 Subject: Close popups on non-client area mouse press. Fixed QComboBox popup issue which was left open if window was moved(dragged) to another position. Task-number: QTBUG-1894 Task-number: QTBUG-26120 Task-number: QTBUG-26465 Task-number: QTBUG-26827 Change-Id: I7e37b37881cdf94574d79f7e77d36f5bbc15f732 Reviewed-by: Andy Shaw Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ac75b9e..43fe26c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8374,6 +8374,17 @@ bool QWidget::event(QEvent *event) case QEvent::MouseButtonDblClick: mouseDoubleClickEvent((QMouseEvent*)event); break; + + case QEvent::NonClientAreaMouseButtonPress: { + QWidget* w; + while ((w = QApplication::activePopupWidget()) && w != this) { + w->close(); + if (QApplication::activePopupWidget() == w) // widget does not want to disappear + w->hide(); // hide at least + } + break; + } + #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: wheelEvent((QWheelEvent*)event); -- cgit v0.12