iOS: Don't try to set screen orientation before QApplication startup
We create our QIOSViewController in didFinishLaunchingWithOptions, and schedule a timer to run the user's main. If the device is placed in landscape orientation at startup, we will receive a willRotateToInterfaceOrientation message before the timer is triggered to run the user's main, which means we do not yet have a QApplication. To fix this crash we exit early, but we might have to store the new orientation for later, and make sure the initial QScreen is then created with the correct orientation. Change-Id: I0cc02f0d36b992d190736e98858dc7d002d595b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
ded4613ae4
commit
4afb128d31
@ -78,6 +78,10 @@
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
|
||||
if (!QCoreApplication::instance())
|
||||
return; // FIXME: Store orientation for later (?)
|
||||
|
||||
Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation));
|
||||
if (orientation == -1)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user