summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <[email protected]>2023-06-20 11:29:21 +0800
committerYuhang Zhao <[email protected]>2023-06-23 14:21:12 +0000
commitc0365d86a43182c2c4390967070aba42fc851cd1 (patch)
treebc0272b908390fcbd396bb5ebd3cc1a666ad9c7f
parent8e2291763d885e53cc55d5b56da18ec62f090900 (diff)
WASM: don't ignore custom QSurfaceFormat settings
Previously, Qt would always ignore user's custom QSurfaceFormat settings and this behavior makes user have no way to control the preferred OpenGL version when running on WASM. And after reading the wasm platform plugin code, I don't see any reason why we should limit ourself to the default OpenGL version. And I've tested this patch locally, Qt still work normally if I set a newer OpenGL version. Change-Id: I0cfb831d6a722fe61cc85808a6d9e3098c73d82e Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]> (cherry picked from commit 33a9cbef657d598589500d2eecea192b83f79b3c)
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp5
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index 336a2a3a3f4..dfe6bf413c7 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -139,6 +139,11 @@ QWasmWindow::~QWasmWindow()
#endif
}
+QSurfaceFormat QWasmWindow::format() const
+{
+ return window()->requestedFormat();
+}
+
void QWasmWindow::onRestoreClicked()
{
window()->setWindowState(Qt::WindowNoState);
diff --git a/src/plugins/platforms/wasm/qwasmwindow.h b/src/plugins/platforms/wasm/qwasmwindow.h
index c233ef81239..2b5e950ebc4 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.h
+++ b/src/plugins/platforms/wasm/qwasmwindow.h
@@ -44,6 +44,8 @@ public:
QWasmBackingStore *backingStore);
~QWasmWindow() final;
+ QSurfaceFormat format() const override;
+
void destroy();
void paint();
void setZOrder(int order);