From cd1ce77bf8a3520dee1c2703405c2bf2762360a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:35:28 +0100 Subject: iOS: Apply default geometry to platform window if not set on QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/ios/qioswindow.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') 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()); } -- cgit v1.2.3