diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-12-04 14:41:36 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-12-06 20:46:51 +0000 |
commit | e37c9d5d5f4ba9874808a4e565c36b2953eb96da (patch) | |
tree | 1a7f0a1ae885fccfb6ff8114c4eed9e197bb7908 /src/plugins/platforms/ios/qiosapplicationstate.h | |
parent | 77942a1bdf9fe22d8f076e59ce19fe9a9d7870d7 (diff) |
iOS: Harden application state change logic
Make sure we catch application state changes as early as possible,
and deal properly with any changes delivered before we have an app
to send them to.
Change-Id: I6d0ea0398f9fab88fc182342769b075cb144227f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios/qiosapplicationstate.h')
-rw-r--r-- | src/plugins/platforms/ios/qiosapplicationstate.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/platforms/ios/qiosapplicationstate.h b/src/plugins/platforms/ios/qiosapplicationstate.h index 1c77b26da1..a68147a72a 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.h +++ b/src/plugins/platforms/ios/qiosapplicationstate.h @@ -40,20 +40,24 @@ #ifndef QIOSAPPLICATIONSTATE_H #define QIOSAPPLICATIONSTATE_H -#include <QtCore/qglobal.h> -#include <QtCore/qvector.h> +#include <QtCore/qobject.h> -Q_FORWARD_DECLARE_OBJC_CLASS(NSObject); +#include <UIKit/UIApplication.h> QT_BEGIN_NAMESPACE -class QIOSApplicationState +class QIOSApplicationState : public QObject { + Q_OBJECT public: QIOSApplicationState(); - ~QIOSApplicationState(); -private: - QVector<NSObject*> m_observers; + + static void handleApplicationStateChanged(UIApplicationState state, const QString &reason); + static Qt::ApplicationState toQtApplicationState(UIApplicationState state); + +Q_SIGNALS: + void applicationStateWillChange(Qt::ApplicationState); + void applicationStateDidChange(Qt::ApplicationState); }; QT_END_NAMESPACE |