summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioswindow.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-12-04 16:35:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-05 13:41:53 +0100
commitcd1ce77bf8a3520dee1c2703405c2bf2762360a8 (patch)
treed156adbc5bac64b5b09e9e1ab7c4b01e74d045c2 /src/plugins/platforms/ios/qioswindow.mm
parent95822e28e2b83730bab01b0c2f79f3c5a17d4090 (diff)
iOS: Apply default geometry to platform window if not set on QWindow
If a platform window is created from a QWindow without setting a valid size or position on the QWindow, the platform window is expected to apply sane defaults. We use the baseclass initialGeometry() function for this, similar to other platform plugins. The default geometry unless otherwise set and/or calculated based on size hints is that of the screen's available geometry. An improvement to this is to detect whenever we apply the screen geometry, and also apply the appropriate window state, but that needs more testing. Change-Id: I02b12064ce6d55c04fe0cc2cd1d2816ca1113f40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 587ecad61c..7ab136e8b9 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -449,10 +449,18 @@ QT_BEGIN_NAMESPACE
QIOSWindow::QIOSWindow(QWindow *window)
: QPlatformWindow(window)
, m_view([[QUIView alloc] initWithQIOSWindow:this])
- , m_normalGeometry(QPlatformWindow::geometry())
, m_windowLevel(0)
{
setParent(QPlatformWindow::parent());
+
+ // Resolve default window geometry in case it was not set before creating the
+ // platform window. This picks up eg. minimum-size if set, and defaults to
+ // the "maxmized" geometry (even though we're not in that window state).
+ // FIXME: Detect if we apply a maximized geometry and send a window state
+ // change event in that case.
+ m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(),
+ screen()->availableGeometry().width(), screen()->availableGeometry().height());
+
setWindowState(window->windowState());
}