Failed to build graphics pipeline state in qt quick application

1

I have a qt quick pyside application .I had a question before,but now another proplem is there .Just a empty window appears and then in application window I see below message.Although I have another qt quick application that I written that in c++ and there is no problem displaying it, this message is displayed!,This application is in python(pyside6)

I use Qt 6.0.2,Python 3.9.2,Qt Creator 4.14.1 and Pyside6

Failed to create vertex shader: Error 0x80070057: The parameter is incorrect.
Failed to build graphics pipeline state

*main.qml

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15

Window {
    id:mainWindow
    width: 1000
    height: 580
    visible: true
    title: qsTr("JooyaTrader")

    Rectangle{

        width: 152
        height: 62
        anchors.fill: parent
        color: "red"
    }
}

main.py

import sys,os
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
import PySide6

if __name__ == "__main__":
    app = QGuiApplication(sys.argv)
    engine = QQmlApplicationEngine()
    engine.load(os.path.join(os.path.dirname(__file__), "main.qml"))
    if not engine.rootObjects():
        sys.exit(-1)
    sys.exit(app.exec_())
python
qt
pyside
qtquick2
pyside6
asked on Stack Overflow Mar 7, 2021 by mohsen • edited Mar 7, 2021 by mohsen

1 Answer

2

The problem is caused because the backend that Qt Quick uses for rendering does not work for your case, either because there are missing libraries or the version is not according to what Qt expects. In that one solution is to set the QT_QUICK_BACKEND in "software" making the rendering do it Qt Quick 2D Renderer:

os.environ["QT_QUICK_BACKEND"] = "software"

app = QGuiApplication(sys.argv)

For more information read Scene Graph Adaptations.

answered on Stack Overflow Mar 7, 2021 by eyllanesc

User contributions licensed under CC BY-SA 3.0