iOS: Prevent recursion when updating/syncing QIOSViewController properties

Change-Id: I22f1eaa892cba23c498ae210a9a483e468268581
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-01-07 15:14:17 +01:00 committed by Tor Arne Vestbø
parent 95cb745e00
commit 56a82e87e6

View File

@ -41,6 +41,8 @@
#import "qiosviewcontroller.h"
#include <QtCore/qscopedvaluerollback.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <QtGui/QScreen>
@ -121,6 +123,7 @@
@interface QIOSViewController () {
QIOSScreen *m_screen;
BOOL m_updatingProperties;
}
@property (nonatomic, assign) BOOL changingOrientation;
@end
@ -289,6 +292,15 @@
if (!isQtApplication())
return;
// Prevent recursion caused by updating the status bar appearance (position
// or visibility), which in turn may cause a layout of our subviews, and
// a reset of window-states, which themselves affect the view controller
// properties such as the statusbar visibilty.
if (m_updatingProperties)
return;
QScopedValueRollback<BOOL> updateRollback(m_updatingProperties, YES);
QWindow *focusWindow = QGuiApplication::focusWindow();
// If we don't have a focus window we leave the statusbar