Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.3.2
-
None
Description
I'm trying to display two QQuickView objects on two canvases/screens, like so:
#include <QGuiApplication> #include <QQuickView> int main(int argc, char *argv[]){ QGuiApplication app(argc, argv); const auto screens = app.screens(); if(screens.size() < 2){ qDebug() << "Expected at least 2 screens"; return 1; } for(auto & screen : screens){ qDebug() << screen; } QQuickView mainViewer; mainViewer.setScreen(screens[0]); mainViewer.setSource(QUrl(u"qrc:/wasm-multiwindow/main.qml"_qs)); mainViewer.setResizeMode(QQuickView::SizeRootObjectToView); QQuickView secondViewer; secondViewer.setScreen(screens[1]); secondViewer.setSource(QUrl(u"qrc:/wasm-multiwindow/second.qml"_qs)); secondViewer.setResizeMode(QQuickView::SizeRootObjectToView); mainViewer.show(); secondViewer.show(); return app.exec(); }
This code runs perfectly on Linux X11 target with 2 physical displays, but fails for webassembly:
QRhiGles2: Failed to make context current. Expect bad things to happen. Failed to start frame
If I set the same screen for both QQuickView objects, there's no error, but only one of them is visible of course.
Also, I have no problem creating two QWidgets on two canvases:
// this works #include <QApplication> #include <QWidget> int main(int argc, char *argv[]){ QApplication app(argc, argv); const auto screens = app.screens(); if(screens.size() < 2){ qDebug() << "Expected at least 2 screens"; return 1; } QWidget w1; w1.setScreen(screens[0]); w1.show(); QWidget w2; w2.setScreen(screens[1]); w2.show(); return app.exec(); }
I attached a minimal example with a modified HTML file containing 2 canvases.
I tested the code both in Firefox and Chromium.
Attachments
Issue Links
- is blocked by
-
QTBUG-80508 QSGGuiThreadRenderLoop uses single context for all windows
- Closed
- mentioned in
-
Page Loading...