diff options
Diffstat (limited to 'sources/pyside6/doc/extras/QtQml.qmlRegisterSingletonType.rst')
-rw-r--r-- | sources/pyside6/doc/extras/QtQml.qmlRegisterSingletonType.rst | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sources/pyside6/doc/extras/QtQml.qmlRegisterSingletonType.rst b/sources/pyside6/doc/extras/QtQml.qmlRegisterSingletonType.rst new file mode 100644 index 000000000..83102bf86 --- /dev/null +++ b/sources/pyside6/doc/extras/QtQml.qmlRegisterSingletonType.rst @@ -0,0 +1,44 @@ +.. currentmodule:: PySide6.QtQml +.. _qmlRegisterSingletonType: + +qmlRegisterSingletonType +************************ + +.. py:function:: qmlRegisterSingletonType(pytype: type, uri: str, versionMajor: int, versionMinor: int, typeName: str) -> int + + :param type pytype: Python class + :param str uri: uri to use while importing the component in QML + :param int versionMajor: major version + :param int versionMinor: minor version + :param str typeName: name exposed to QML + :return: int (the QML type id) + + This function registers a Python type as a singleton in the QML system. + +.. py:function:: qmlRegisterSingletonType(pytype: type, uri: str, versionMajor: int, versionMinor: int, typeName: str, callback: object) -> int + + :param type pytype: Python class + :param str uri: uri to use while importing the component in QML + :param int versionMajor: major version + :param int versionMinor: minor version + :param str typeName: name exposed to QML + :param object callback: Python callable (to handle Python type) + :return: int (the QML type id) + + This function registers a Python type as a singleton in the QML system using + the provided callback (which gets a QQmlEngine as a parameter) to generate + the singleton. + + +.. py:function:: qmlRegisterSingletonType(uri: str, versionMajor: int, versionMinor: int, typeName: str, callback: object) -> int + + :param str uri: uri to use while importing the component in QML + :param int versionMajor: major version + :param int versionMinor: minor version + :param str typeName: name exposed to QML + :param object callback: Python callable (to handle QJSValue) + :return: int (the QML type id) + + This function registers a QJSValue as a singleton in the QML system using + the provided callback (which gets a QQmlEngine as a parameter) to + generate the singleton. |