Potential QQuickWidget broken on Qt6.2?
-
Good afternoon all,
I've recently tried upgrading to Qt6.2 from Qt5.12 recently and have hit an interesting issue I was hoping if anyone else noticed. Below is a barebones example so hopefully its reproducable, as I can reproduce it on my machine with just this.
Basically the issue is that QMainWindow no longer likes having a QQuickWidget set as the Central Widget. If you run the code below, it will run perfectly fine as you would expect. However, if you uncomment
_module = new QQuickWidget();
and comment_module = new QWidget();
the application will crash when trying toshow()
. Note, this also crashes withshowMaximise();
but I assume those are connected.class Playground : public QMainWindow { public: Playground() { //_module = new QQuickWidget(); _module = new QWidget(); setCentralWidget(_module); } private: QWidget* _module = nullptr; }; int main(int argc, char* argv[]) { QApplication application(argc, argv); Playground playground; playground.show(); return QApplication::exec(); }
As you would expect this is quite an issue! So I'm putting it out to see if anyone else has had this problem?
The actual crash message is something I've never seen before as well
! Debugger reported unrelated range(s) for 0x00007ffcf393a77a: [0x00007ffcf393a37a..0x00007ffcf393a3ab]
Additional notes:
Fresh Qt6.2 on 05/10/2021
IDE: CLion
CMake
OS: WindowsDanke in advanced
-
@ChiefyChief I have just installed 6.2 on Windows, just to have a look at. I tried your example and for the quickwidget case I see no window and this on the console:
QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default. 17:39:09: The program has unexpectedly finished. 17:39:09: The process was ended forcefully.
If I add this in main, before the
Playground
instantiation, it works for me:QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
-
@ChiefyChief I don't reproduce the problem on Linux with Qt6 6.2.0
-
@ChiefyChief I have just installed 6.2 on Windows, just to have a look at. I tried your example and for the quickwidget case I see no window and this on the console:
QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default. 17:39:09: The program has unexpectedly finished. 17:39:09: The process was ended forcefully.
If I add this in main, before the
Playground
instantiation, it works for me:QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
-
Thank you both for your answers.
@Bob64 This addition has made my application now work again, so thank you very much for this!
@eyllanesc Thanks for confirming this on Linux too, but I'm curious that it actually worked for you without changing the Graphics Api!Danke
-
@ChiefyChief Most likely, on Linux
QSGRendererInterface::OpenGL
is used by default -
@Bob64
you answer solves my problem, thank you so mack! -