summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTinja Paavoseppä <tinja.paavoseppa@qt.io>2024-04-10 15:32:04 +0300
committerTinja Paavoseppä <tinja.paavoseppa@qt.io>2024-04-26 18:37:55 +0300
commit88168fa85dae337410169bf54e6bdf5b20e3023e (patch)
tree8eeabe5070730f3475f9c6ea4babe169347ed3ea /src/plugins
parentecc9516d15ece58b70eb8d0064fec6c13024da03 (diff)
Android: Add QT_ANDROID_SURFACE_CONTAINER_TYPE env var
The Android QPA picks between two types of Views that can provide a Surface for it, SurfaceView and TextureView. Normally, SurfaceView is used if there's just one window in the app, and TextureView is used for any additional windows, since it allows better control over the z order between the windows. Add an environment variable QT_ANDROID_SURFACE_CONTAINER_TYPE that can be used to override the normal choosing strategy, and force the application to use either one of the View classes for all the windows of the app. This helps with testing changes to the Android QPA windowing, as you can use the same app to test both Surface Views easily. Pick-to: 6.7 Change-Id: Icc15fd9675175b854354a379b6ffa7ae5532408e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index e47281664d..979f0fb98a 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -64,11 +64,20 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
if (window->isTopLevel())
platformScreen()->addWindow(this);
- // TODO should handle case where this changes at runtime -> need to change existing window
- // into TextureView (or perhaps not, if the parent window would be SurfaceView, as long as
- // onTop was false it would stay below the children)
- if (platformScreen()->windows().size() <= 1)
+ static bool ok = false;
+ static const int value = qEnvironmentVariableIntValue("QT_ANDROID_SURFACE_CONTAINER_TYPE", &ok);
+ if (ok) {
+ static const SurfaceContainer type = static_cast<SurfaceContainer>(value);
+ if (type == SurfaceContainer::SurfaceView || type == SurfaceContainer::TextureView)
+ m_surfaceContainerType = type;
+ } else if (platformScreen()->windows().size() <= 1) {
+ // TODO should handle case where this changes at runtime -> need to change existing window
+ // into TextureView (or perhaps not, if the parent window would be SurfaceView, as long as
+ // onTop was false it would stay below the children)
m_surfaceContainerType = SurfaceContainer::SurfaceView;
+ }
+ qCDebug(lcQpaWindow) << "Window" << m_nativeViewId << "using surface container type"
+ << static_cast<int>(m_surfaceContainerType);
}
QAndroidPlatformWindow::~QAndroidPlatformWindow()