iOS: Implement QPlatformWindow::setWindowState()

In both maximized and fullscreen modes we assume that we can use the
availableGeometry() of the QScreen, but of course this depends on us
showing or hiding the statusbar first, as well as QScreen actually
returning the right availableGeometry when the statusbar is shown.
The latter is not the case right now, as we initialize QScreen before
UIApplication has been set up and UIScreen has had a chance to init
itself based on the precense of a statusbar or not.

Change-Id: Id44dee3550f7135ffe2852b377bb6c7b6d522d68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
bb10
Tor Arne Vestbø 2012-11-09 17:20:47 +01:00
parent e123056c47
commit 3241f37711
2 changed files with 20 additions and 0 deletions

View File

@ -85,6 +85,8 @@ public:
void setGeometry(const QRect &rect);
void updateGeometry(const QRect &rect);
void setWindowState(Qt::WindowState state);
GLuint framebufferObject(const QIOSContext &context) const;
EAGLView *nativeView() const { return m_view; }

View File

@ -203,6 +203,8 @@ QIOSWindow::QIOSWindow(QWindow *window)
if ([uiApplication.delegate isMemberOfClass:[QIOSApplicationDelegate class]])
[uiApplication.delegate.window.rootViewController.view addSubview:m_view];
}
setWindowState(window->windowState());
}
QIOSWindow::~QIOSWindow()
@ -235,6 +237,22 @@ void QIOSWindow::updateGeometry(const QRect &rect)
QWindowSystemInterface::handleGeometryChange(window(), rect);
}
void QIOSWindow::setWindowState(Qt::WindowState state)
{
// FIXME: Figure out where or how we should disable/enable the statusbar.
// Perhaps setting QWindow to maximized should also mean that we'll show
// the statusbar, and vice versa for fullscreen?
switch (state) {
case Qt::WindowMaximized:
case Qt::WindowFullScreen:
setGeometry(QRect(QPoint(0, 0), window()->screen()->availableSize()));
break;
default:
break;
}
}
GLuint QIOSWindow::framebufferObject(const QIOSContext &context) const
{
static GLuint framebuffer = 0;