diff options
-rw-r--r-- | examples/widgets/mainwindows/application/mainwindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 88 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qsessionmanager.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 7 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 1 |
8 files changed, 1 insertions, 106 deletions
diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp index d0c009427f..9c0910ae63 100644 --- a/examples/widgets/mainwindows/application/mainwindow.cpp +++ b/examples/widgets/mainwindows/application/mainwindow.cpp @@ -70,7 +70,6 @@ MainWindow::MainWindow() this, &MainWindow::documentWasModified); #ifndef QT_NO_SESSIONMANAGER - QGuiApplication::setFallbackSessionManagementEnabled(false); connect(qApp, &QGuiApplication::commitDataRequest, this, &MainWindow::commitData); #endif diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp index 7f901ecd8d..d26a15f783 100644 --- a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp +++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp @@ -80,7 +80,6 @@ int main(int argc, char *argv[]) MyMainWidget::MyMainWidget(QWidget *parent) : QWidget(parent) { - QGuiApplication::setFallbackSessionManagementEnabled(false); connect(qApp, &QGuiApplication::commitDataRequest, this, &MyMainWidget::commitData); } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d3e97ebe5c..b8acf5c396 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -162,10 +162,6 @@ QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr; QList<QObject *> QGuiApplicationPrivate::generic_plugin_list; -#ifndef QT_NO_SESSIONMANAGER -bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true; -#endif - enum ApplicationResourceFlags { ApplicationFontExplicitlySet = 0x2 @@ -721,9 +717,6 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::highDpiScalingUpdated = false; QGuiApplicationPrivate::currentDragWindow = nullptr; QGuiApplicationPrivate::tabletDevicePoints.clear(); -#ifndef QT_NO_SESSIONMANAGER - QGuiApplicationPrivate::is_fallback_session_management_enabled = true; -#endif QGuiApplicationPrivate::mousePressTime = 0; QGuiApplicationPrivate::mousePressX = QGuiApplicationPrivate::mousePressY = 0; } @@ -3649,27 +3642,6 @@ bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWind return true; } -bool QGuiApplicationPrivate::tryCloseAllWindows() -{ - return tryCloseRemainingWindows(QWindowList()); -} - -bool QGuiApplicationPrivate::tryCloseRemainingWindows(QWindowList processedWindows) -{ - QWindowList list = QGuiApplication::topLevelWindows(); - for (int i = 0; i < list.size(); ++i) { - QWindow *w = list.at(i); - if (w->isVisible() && !processedWindows.contains(w)) { - if (!w->close()) - return false; - processedWindows.append(w); - list = QGuiApplication::topLevelWindows(); - i = -1; - } - } - return true; -} - void QGuiApplicationPrivate::processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *windowSystemEvent) { QEvent event(QEvent::Quit); @@ -3771,57 +3743,6 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo emit qApp->applicationStateChanged(applicationState); } -#ifndef QT_NO_SESSIONMANAGER -// ### Qt6: consider removing the feature or making it less intrusive -/*! - \since 5.6 - - Returns whether QGuiApplication will use fallback session management. - - The default is \c true. - - If this is \c true and the session manager allows user interaction, - QGuiApplication will try to close toplevel windows after - commitDataRequest() has been emitted. If a window cannot be closed, session - shutdown will be canceled and the application will keep running. - - Fallback session management only benefits applications that have an - "are you sure you want to close this window?" feature or other logic that - prevents closing a toplevel window depending on certain conditions, and - that do nothing to explicitly implement session management. In applications - that \e do implement session management using the proper session management - API, fallback session management interferes and may break session - management logic. - - \warning If all windows \e are closed due to fallback session management - and quitOnLastWindowClosed() is \c true, the application will quit before - it is explicitly instructed to quit through the platform's session - management protocol. That violation of protocol may prevent the platform - session manager from saving application state. - - \sa setFallbackSessionManagementEnabled(), - QSessionManager::allowsInteraction(), saveStateRequest(), - commitDataRequest(), {Session Management} -*/ -bool QGuiApplication::isFallbackSessionManagementEnabled() -{ - return QGuiApplicationPrivate::is_fallback_session_management_enabled; -} - -/*! - \since 5.6 - - Sets whether QGuiApplication will use fallback session management to - \a enabled. - - \sa isFallbackSessionManagementEnabled() -*/ -void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled) -{ - QGuiApplicationPrivate::is_fallback_session_management_enabled = enabled; -} -#endif // QT_NO_SESSIONMANAGER - /*! \since 4.2 \fn void QGuiApplication::commitDataRequest(QSessionManager &manager) @@ -3846,8 +3767,7 @@ void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled) \note You should use Qt::DirectConnection when connecting to this signal. - \sa setFallbackSessionManagementEnabled(), isSessionRestored(), - sessionId(), saveStateRequest(), {Session Management} + \sa isSessionRestored(), sessionId(), saveStateRequest(), {Session Management} */ /*! @@ -3955,13 +3875,7 @@ void QGuiApplicationPrivate::commitData() { Q_Q(QGuiApplication); is_saving_session = true; - emit q->commitDataRequest(*session_manager); - if (is_fallback_session_management_enabled && session_manager->allowsInteraction() - && !tryCloseAllWindows()) { - session_manager->cancel(); - } - is_saving_session = false; } diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index ac90e18ef9..c71ed52556 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -168,9 +168,6 @@ public: QString sessionId() const; QString sessionKey() const; bool isSavingSession() const; - - static bool isFallbackSessionManagementEnabled(); - static void setFallbackSessionManagementEnabled(bool); #endif static void sync(); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index f8cd8809e8..41b745e569 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -107,7 +107,6 @@ public: virtual bool shouldQuit() override; bool shouldQuitInternal(const QWindowList &processedWindows); - virtual bool tryCloseAllWindows(); static void captureGlobalModifierState(QEvent *e); static Qt::KeyboardModifiers modifier_buttons; @@ -279,7 +278,6 @@ public: #endif #ifndef QT_NO_SESSIONMANAGER - static bool is_fallback_session_management_enabled; QSessionManager *session_manager; bool is_session_restored; bool is_saving_session; @@ -341,7 +339,6 @@ protected: virtual QPalette basePalette() const; virtual void handlePaletteChanged(const char *className = nullptr); - bool tryCloseRemainingWindows(QWindowList processedWindows); #if QT_CONFIG(draganddrop) virtual void notifyDragStarted(const QDrag *); #endif // QT_CONFIG(draganddrop) diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index 8747e02719..026e855874 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -76,9 +76,6 @@ QT_BEGIN_NAMESPACE QSessionManager object as argument. The session manager can only be accessed in slots invoked by these signals. - \warning If you use QSessionManager, you should disable fallback session - management: QGuiApplication::setFallbackSessionManagementEnabled(). - No user interaction is possible \e unless the application gets explicit permission from the session manager. You ask for permission by calling allowsInteraction() or, if it is really urgent, allowsErrorInteraction(). diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 7b467d0a3b..ae888f061e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1602,13 +1602,6 @@ retry: return true; } -bool QApplicationPrivate::tryCloseAllWindows() -{ - QWindowList processedWindows; - return QApplicationPrivate::tryCloseAllWidgetWindows(&processedWindows) - && QGuiApplicationPrivate::tryCloseRemainingWindows(processedWindows); -} - /*! Closes all top-level windows. diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 035d3e3220..971ade7284 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -107,7 +107,6 @@ public: virtual void notifyActiveWindowChange(QWindow *) override; virtual bool shouldQuit() override; - bool tryCloseAllWindows() override; static bool autoSipEnabled; static QString desktopStyleKey(); |