From 013afc77f0a191ee60d0d2d6b84d35435fdc9c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Mar 2015 11:23:31 +0100 Subject: Add Qt::WindowFlag to signal that maximizing should cover full screen geometry Normally when maximizing a window it will cover the available geometry of the screen, as represented by QScreen::availableGeometry(), which typically excludes status/menu bars and application launchers. On some platforms it may still be possible to place windows in the areas of the screen that are outside of the available geometry, but this will result in the window being partially covered by (possibly) transparent system UIs. The new flag allows the user to specify that when maximizing the window it should try to cover as much as possible of the screen geometry (in contrast to going full screen, which would typically hide any system UIs). For iOS this is a common use-case, as the status bar is transparent, and the user-interface guidelines for iOS7 and up recommend taking advantage of the full screen space, while keeping any user-interaction elements still inside the available geometry of the screen. Change-Id: I86d7fc937916d9cae245f7a3f9ae46abd92cdd29 Reviewed-by: Lars Knoll Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/global/qnamespace.h | 1 + src/corelib/global/qnamespace.qdoc | 9 +++++++++ src/plugins/platforms/ios/qioswindow.mm | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 420b8b0430..3a7356d0fe 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -287,6 +287,7 @@ public: WindowTransparentForInput = 0x00080000, WindowOverridesSystemGestures = 0x00100000, WindowDoesNotAcceptFocus = 0x00200000, + MaximizeUsingFullscreenGeometryHint = 0x00400000, CustomizeWindowHint = 0x02000000, WindowStaysOnBottomHint = 0x04000000, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ba3a621751..669bc7a17a 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2159,6 +2159,15 @@ \value WindowDoesNotAcceptFocus Informs the window system that this window should not receive the input focus. + \value MaximizeUsingFullscreenGeometryHint Informs the window system that when + maximizing the window it should use as much of the available screen geometry + as possible, including areas that may be covered by system UI such as status + bars or application launchers. This may result in the window being placed + under these system UIs, but does not guarantee it, depending on whether or + not the platform supports it. When the flag is enabled the user is responsible + for taking QScreen::availableGeometry() into account, so that any UI elements + in the application that require user interaction are not covered by system UI. + \value WindowType_Mask A mask for extracting the window type part of the window flags. diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 95a4c28246..777a3c12c5 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -244,7 +244,8 @@ void QIOSWindow::setWindowState(Qt::WindowState state) applyGeometry(m_normalGeometry); break; case Qt::WindowMaximized: - applyGeometry(screen()->availableGeometry()); + applyGeometry(window()->flags() & Qt::MaximizeUsingFullscreenGeometryHint ? + screen()->geometry() : screen()->availableGeometry()); break; case Qt::WindowFullScreen: applyGeometry(screen()->geometry()); -- cgit v1.2.3