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>
This commit is contained in:
Tor Arne Vestbø 2013-12-04 16:35:28 +01:00 committed by The Qt Project
parent 95822e28e2
commit cd1ce77bf8

View File

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