QtDataVisualization Surface3D QML item crashes app when using Qt6
-
The following QML script works when using Qt 5.15.9 but crashes when using 6.2.4 and 6.3.0.
import QtQuick 2.15 import QtQuick.Window 2.15 import QtDataVisualization 1.15 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Surface3D {} }
The Qt Quick 2 Spectrogram Example (which uses the Surface3D item) works with 6.3.0.
I'm using Windows 10 and installed Qt with MinGW 11.2.0 64-bit (for Qt6) and MinGW 8.1.0 64-bit (for Qt5).
Is there any reason this shouldn't be working with Qt6? Any guidance is much appreciated! -
I face the same problem, when using Surface3D in Qt 6.3 the app crashes on startup. For Qt 5 it works fine
-
I find the solution, from the documentation:
it is necessary to define the rendering backend explicitly either on your environment variables, or in your application main. It can be defined by adding qputenv("QSG_RHI_BACKEND", "opengl"); in the beginning of your main function.https://forum.qt.io/topic/136770/qtdatavisualization-surface3d-qml-item-crashes-app-when-using-qt6/2
-
Great, thank you! Here's the link to the documentation for anyone who is curious.