From de9aa48618252f3083ed571ef93a46d1b4a9c9f9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 23 Dec 2016 12:16:58 +0100 Subject: [PATCH] Qt4/Qt5 neutral changes: connect to commitDataRequest signal for session management --- src/Gui/GuiApplication.cpp | 4 +++- src/Gui/GuiApplication.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index eb7801544..00b15f2c4 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -62,6 +62,8 @@ using namespace Gui; GUIApplication::GUIApplication(int & argc, char ** argv) : GUIApplicationNativeEventAware(argc, argv) { + connect(this, SIGNAL(commitDataRequest(QSessionManager &)), + SLOT(slotCommitData(QSessionManager &)), Qt::DirectConnection); } GUIApplication::~GUIApplication() @@ -130,7 +132,7 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event) return true; } -void GUIApplication::commitData(QSessionManager &manager) +void GUIApplication::slotCommitData(QSessionManager &manager) { if (manager.allowsInteraction()) { if (!Gui::getMainWindow()->close()) { diff --git a/src/Gui/GuiApplication.h b/src/Gui/GuiApplication.h index b245ae02f..1f781a93f 100644 --- a/src/Gui/GuiApplication.h +++ b/src/Gui/GuiApplication.h @@ -49,11 +49,13 @@ public: * where an unhandled exception comes from. */ bool notify (QObject * receiver, QEvent * event); - void commitData(QSessionManager &manager); /// Pointer to exceptions caught in Qt event handler boost::shared_ptr caughtException; +public Q_SLOTS: + void slotCommitData(QSessionManager &manager); + protected: bool event(QEvent * event); };