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.

Pick-to: 6.6 6.5
Change-Id: I0cfb831d6a722fe61cc85808a6d9e3098c73d82e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Yuhang Zhao 2023-06-20 11:29:21 +08:00
parent 3e801b5477
commit 33a9cbef65
2 changed files with 7 additions and 0 deletions

View File

@ -152,6 +152,11 @@ QWasmWindow::~QWasmWindow()
#endif #endif
} }
QSurfaceFormat QWasmWindow::format() const
{
return window()->requestedFormat();
}
void QWasmWindow::onRestoreClicked() void QWasmWindow::onRestoreClicked()
{ {
window()->setWindowState(Qt::WindowNoState); window()->setWindowState(Qt::WindowNoState);

View File

@ -49,6 +49,8 @@ public:
QWasmBackingStore *backingStore); QWasmBackingStore *backingStore);
~QWasmWindow() final; ~QWasmWindow() final;
QSurfaceFormat format() const override;
void paint(); void paint();
void setZOrder(int order); void setZOrder(int order);
void setWindowCursor(QByteArray cssCursorName); void setWindowCursor(QByteArray cssCursorName);