Since the initial port of PySide to Qt5 (a.k.a PySide2), the interaction with QML was on the list of features we wanted to fully support in our set of bindings, due to the popularity of QML.
With the first official release 5.12, we had cover many use cases for the QML and Python interaction, but also we left out a couple of use cases that were really required by our community. Now that we are developing new features and improvements for Qt6, we wanted to address most of them.
Here you can find a summary of the features that we have done so far for the planned Qt for Python 6.0 release.
The previous limitation of registering a maximum of 50 custom types is gone with 6.0, you may now register as many types as you wish.
Starting with 6.0, you can register custom singletons for use in QML with qmlRegisterSingletonType.
For example if you wanted to expose information about the the operating system to QML, you could create the following class:
class SystemInfo(QObject): def __init__(self): QObject.__init__(self)
e.g. this Snippet will expose ClassForQml to QML and can be imported via the import name and version specified in global variables. This may be especially useful to you if you are registering a lot of types.
We understand that there might be other aspects of the QML + Python interaction that your application currently needs, or will benefit from having it, so we encourage you to share with us missing features, issues, or even new ideas on how we can make Qt for Python a really good alternative for QML-based applications.