QT QML Application slower compared to Widget Application in Python
-
Hello everyone,
I am trying to create a graphical user interface which will run on a QT container on Torizon.
I have tried two different methods to create the graphical user interface. For method 1 I generated the GUI using a QML file and for method 2 I used the QWidgets. I found out that generating a GUI with QWidgets is much faster. Am I doing something wrong with loading the QML file or is a GUI with Widgets just faster compared to a GUI with a QML file?
For both applications, I have used python 3.10.9 together with PySide2. I am running the application on Torizon on a Toradex IMX8 module.
The code which I use to load the QML file in Python is written down below. This code is the same code as the sample code which Torizon provides when you select in Visual Studio Code that you want to create a QT Python Application with QML.
import sys import os import PySide2 from PySide2.QtWidgets import QApplication from PySide2.QtCore import QUrl, QObject from PySide2.QtQuick import QQuickView if __name__ == "__main__": print("Hello world!") app = QApplication(sys.argv) view = QQuickView() qml = QUrl("mainwindow.qml") view.setSource(qml) view.show() sys.exit(app.exec_())Thank you!
-
Hi and welcome to devnet,
Did you check that your hardware has hardware acceleration for QtQuick to take advantage from ?
-
Hi and welcome to devnet,
Did you check that your hardware has hardware acceleration for QtQuick to take advantage from ?
-
Have you tried Qt 6?
-
Have you tried Qt 6?
I am using pyside 2 (so qt5) since that is what Torizon supports according to their website. I could not find whether I could use Pyside6. I have tried it, but I could not get it running. For some reason, the container kept on building with pyside2, even though I had adapted everything to pyside6.
-
My gut feeling would be that somehow your application uses the software OpenGL pipeline rather than the hardware accelerated one. Do you seen any error printed on the console with regard to that ?
-
My gut feeling would be that somehow your application uses the software OpenGL pipeline rather than the hardware accelerated one. Do you seen any error printed on the console with regard to that ?
-
So I would say my hunch was correct, you do not get hardware acceleration since the direct rendering library for your GPU cannot be found.