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 <lars.knoll@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Tor Arne Vestbø 2015-03-20 11:23:31 +01:00
parent a73cead0e0
commit 013afc77f0
3 changed files with 12 additions and 1 deletions

View File

@ -287,6 +287,7 @@ public:
WindowTransparentForInput = 0x00080000,
WindowOverridesSystemGestures = 0x00100000,
WindowDoesNotAcceptFocus = 0x00200000,
MaximizeUsingFullscreenGeometryHint = 0x00400000,
CustomizeWindowHint = 0x02000000,
WindowStaysOnBottomHint = 0x04000000,

View File

@ -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.

View File

@ -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());