summaryrefslogtreecommitdiff
path: root/src/plugins/platforms/android/qandroidplatformscreen.h
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-02-23 18:26:09 +0100
committerIvan Solovev <ivan.solovev@qt.io>2022-03-11 13:29:33 +0100
commita9c5dd09215e5806a57b01c7c4fab366860f15f2 (patch)
tree09e29a731746dc8160e97d5c63360f1cfb8f8816 /src/plugins/platforms/android/qandroidplatformscreen.h
parent3257c262b265300fa5e180b0722ca06d868db633 (diff)
downloadqtbase-a9c5dd09215e5806a57b01c7c4fab366860f15f2.tar.gz
Android: make sure that orientationChange is reported after resize
On Android orientation changes are reported from the DisplayListener.onDisplayChanged() method, while the screen size changes are reported from QtLayout.onSizeChanged(). In practice these callbacks come in random order, so rotating the screen multiple times might result in inconsistent order of signals and events. This patch makes sure that size change events always happen before orientation changes. This is done by caching the new orientation values and reporting them only when needed. At this point we also need to use QMetaObject::invokeMethod() for orientation change, like it is done for geometry change. Otherwise the orientation update can still be processed earlier than the geometry change. Also note that at some point we might get an orientation change without a size change (for example Qt::LandscapeOrientation -> Qt::InvertedLandscapeOrientation). That is the reason for isSimilarRotation() helper function. As a drive-by: ignore size changes with inconsistent values when window size is reported to have old orientation, while the screen has already been rotated. In such cases a new size change will be triggered shortly with normal value. Task-number: QTBUG-94459 Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 79fb80152ff29a30faa3f0cce79a602e36cadbeb)
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformscreen.h')
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h
index 755b5f4e45..83d1dffeec 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.h
+++ b/src/plugins/platforms/android/qandroidplatformscreen.h
@@ -96,6 +96,7 @@ public slots:
void setSizeParameters(const QSize &physicalSize, const QSize &size,
const QRect &availableGeometry);
void setRefreshRate(qreal refreshRate);
+ void setOrientation(Qt::ScreenOrientation orientation);
protected:
bool event(QEvent *event) override;