iOS: Always update screen properties on status bar orientation change

If we move from landscape to inverse landscape orientation, the window
will not lay out, so we won't hit viewWillLayoutSubviews, but we still
need to reflect the new orientation of the screen.

Task-number: QTBUG-137249
Pick-to: 6.10 6.9 6.8
Change-Id: I9655052772990ca524c5b94e25b2c58cc058ff67
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-06-02 13:25:44 +02:00
parent a8dab6eb65
commit c604f2031a

View File

@ -367,10 +367,12 @@
// If the statusbar changes orientation due to auto-rotation we don't care, // If the statusbar changes orientation due to auto-rotation we don't care,
// there will be re-layout anyways. Only if the statusbar changes due to // there will be re-layout anyways. Only if the statusbar changes due to
// reportContentOrientation, we need to update the window layout. // reportContentOrientation, we need to update the window layout.
if (self.changingOrientation) if (!self.changingOrientation)
return; [self.view setNeedsLayout];
[self.view setNeedsLayout]; // But we always need to update the screen's orientation
if (self.platformScreen)
self.platformScreen->updateProperties();
} }
#endif #endif
@ -379,6 +381,9 @@
if (!QCoreApplication::instance()) if (!QCoreApplication::instance())
return; return;
// Make sure the screen properties are up to date before layout.
// We need this here, even if we also react to status bar orientation
// changes, as only the main screen on iOS has a statusbar.
if (self.platformScreen) if (self.platformScreen)
self.platformScreen->updateProperties(); self.platformScreen->updateProperties();
} }