summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp23
-rw-r--r--src/widgets/kernel/qapplication_p.h1
2 files changed, 13 insertions, 11 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index de450923ff..9069b9005d 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2628,16 +2628,6 @@ bool QApplicationPrivate::shouldQuit()
return QGuiApplicationPrivate::shouldQuitInternal(processedWindows);
}
-static inline void closeAllPopups()
-{
- // Close all popups: In case some popup refuses to close,
- // we give up after 1024 attempts (to avoid an infinite loop).
- int maxiter = 1024;
- QWidget *popup;
- while ((popup = QApplication::activePopupWidget()) && maxiter--)
- popup->close();
-}
-
/*! \reimp
*/
bool QApplication::notify(QObject *receiver, QEvent *e)
@@ -2711,7 +2701,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// Close all popups (triggers when switching applications
// by pressing ALT-TAB on Windows, which is not receive as key event.
// triggers when the screen rotates.)
- closeAllPopups();
+ d->closeAllPopups();
break;
case QEvent::Wheel: // User input and window activation makes tooltips sleep
case QEvent::ActivationChange:
@@ -3444,6 +3434,17 @@ extern QWidget *qt_popup_down;
extern bool qt_replay_popup_mouse_event;
extern bool qt_popup_down_closed;
+bool QApplicationPrivate::closeAllPopups()
+{
+ // Close all popups: In case some popup refuses to close,
+ // we give up after 1024 attempts (to avoid an infinite loop).
+ int maxiter = 1024;
+ QWidget *popup;
+ while ((popup = QApplication::activePopupWidget()) && maxiter--)
+ popup->close(); // this will call QApplicationPrivate::closePopup
+ return true;
+}
+
void QApplicationPrivate::closePopup(QWidget *popup)
{
if (!popupWidgets)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index ee41f91060..59c13f06af 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -145,6 +145,7 @@ public:
static bool inPopupMode();
bool popupActive() override { return inPopupMode(); }
+ bool closeAllPopups() override;
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);