path: root/src/corelib/global
diff options
authorRichard Moe Gustavsen <>2013-02-28 14:57:27 +0100
committerThe Qt Project <>2013-03-04 14:54:57 +0100
commite27ca37d18a1a2bbddce3479e34fa12b88ba481c (patch)
treeed5886f193423084680ce685d1fdab70436940ad /src/corelib/global
parent2f31bbd9ccd4d6e7e6ed1dd89ab5648f69a2e8b4 (diff)
ApplicationStates: add more states to Qt::ApplicationState
On mobile platforms, Qt::ApplicationActive and Qt::ApplicationInactive are not sufficient to describe the different states an application can be in. This patch introduces Qt::ApplicationHidden and Qt::ApplicationSuspended that should fill in the gaps, at least on Android and iOS. Change-Id: I3f5a584cf6f4832e7c81dea095dcf711a8866c38 Reviewed-by: Samuel Rødal <> Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'src/corelib/global')
2 files changed, 21 insertions, 4 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 6f977d847d..41bca2a443 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -326,8 +326,10 @@ public:
Q_DECLARE_FLAGS(WindowStates, WindowState)
enum ApplicationState {
- ApplicationInactive = 0x00000000,
- ApplicationActive = 0x00000001
+ ApplicationSuspended = 0x00000000,
+ ApplicationHidden = 0x00000001,
+ ApplicationInactive = 0x00000002,
+ ApplicationActive = 0x00000004
Q_DECLARE_FLAGS(ApplicationStates, ApplicationState)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index e1c64aab94..8ec206a572 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1791,8 +1791,23 @@
The states are
- \value ApplicationInactive The application is running in the background.
- \value ApplicationActive The application is running in the foreground.
+ \value ApplicationSuspended The application is about to suspend. When entering this state, the
+ application should save its state, cease all activities, and be
+ prepared for code execution to stop. While suspended, the
+ application can be killed at any time without further warnings
+ (e.g. when low memory forces the OS to purge suspended applications).
+ \value ApplicationHidden The application is hidden and runs in the background. This
+ is the normal state for applications that need to do background
+ processing, like playing music, while the user interacts with
+ other applications. The application should free up all graphical
+ resources when entering this state.
+ \value ApplicationInactive The application is visible, but not selected to be in front.
+ On desktop platforms, this typically means that the user
+ activated another application. On mobile platforms, it is
+ more common to enter this state when the OS is interrupting
+ the user with e.g. incoming calls or SMS-messages.
+ While in this state, consider reducing CPU-intensive tasks.
+ \value ApplicationActive The application is visible and selected to be in front.
\since 5.1