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.
However, I read on different website that a GUI with QtQuick should be faster compared to a GUI with QWidgets. Am I doing something wrong with loading the QML file or is a GUI with QWidgets faster on the Toradex modules 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 using a Toradex module with the IMX8 chip.
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_())