PySide::Qml Namespace

namespace PySide::Qml

Namespace for QML type registration and decorators. More...

Header: #include <pysideqml.h>

Types

Functions

PySide::Qml::QuickRegisterItemFunction getQuickRegisterItemFunction()
PyObject *qmlAnonymousMacro(PyObject *pyObj)
int *qmlAttachedPropertiesObject(PyObject *typeObject, int *obj, bool create = true)
PyObject *qmlElementMacro(PyObject *pyObj)
int qmlRegisterSingletonInstance(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, PyObject *instanceObject)
int qmlRegisterSingletonType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, PyObject *callback, bool isQObject, bool hasCallback)
int qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const char *noCreationReason = nullptr, bool creatable = true)
PyObject *qmlSingletonMacro(PyObject *pyObj)
void setQuickRegisterItemFunction(PySide::Qml::QuickRegisterItemFunction function)

Detailed Description

Type Documentation

[alias] Qml::QuickRegisterItemFunction

Function used by the QtQuick module to fill the QQmlPrivate::RegisterType::parserStatusCast, valueSourceCast and valueInterceptorCast fields with the correct values.

See also PySide::Qml::setQuickRegisterItemFunction().

Function Documentation

PySide::Qml::QuickRegisterItemFunction Qml::getQuickRegisterItemFunction()

Returns the function set by the QtQuick module for registering QQuickItem-derived types.

See also setQuickRegisterItemFunction().

PyObject *Qml::qmlAnonymousMacro(PyObject *pyObj)

PySide implementation of the QML_ANONYMOUS macro (@QmlAnonymous decorator) registering the Python type pyObj.

Returns pyObj or nullptr with a Python error set on failure.

int *Qml::qmlAttachedPropertiesObject(PyObject *typeObject, int *obj, bool create = true)

PySide implementation of the qmlAttachedPropertiesObject<T>() function.

Returns the attached object instance of the attaching type typeObject for the attachee obj. If create is true, the attached object is created if it does not exist yet.

PyObject *Qml::qmlElementMacro(PyObject *pyObj)

PySide implementation of the QML_ELEMENT macro (@QmlElement decorator) registering the Python type pyObj.

Returns pyObj or nullptr with a Python error set on failure.

int Qml::qmlRegisterSingletonInstance(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, PyObject *instanceObject)

PySide implementation of the qmlRegisterSingletonInstance<T>() function.

This is a helper for the legacy free qmlRegisterSingletonInstance<T>() function (pre 6.7) . Decorators should be used instead.

ParameterMeaning
pyObjPython type to be registered.
uriQML element URI.
versionMajorQML component major version.
versionMinorQML component minor version.
qmlNameQML element name.
instanceObjectSingleton object to be registered.

Returns the metatype id of the registered type or -1 on failure.

int Qml::qmlRegisterSingletonType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, PyObject *callback, bool isQObject, bool hasCallback)

PySide implementation of the qmlRegisterSingletonType<T>() function.

This is a helper for the legacy free qmlRegisterSingletonType<T>() function (pre 6.7). Decorators should be used instead.

ParameterMeaning
pyObjPython type to be registered.
uriQML element URI.
versionMajorQML component major version.
versionMinorQML component minor version.
qmlNameQML element name.
callbackCallback creating the singleton instance.
isQObjectWhether the type is a QObject (as opposed to a QJSValue).
hasCallbackWhether callback is set.

Returns the metatype id of the registered type or -1 on failure.

int Qml::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const char *noCreationReason = nullptr, bool creatable = true)

PySide implementation of the qmlRegisterType<T>() function.

This is a helper for the legacy free qmlRegisterType*() functions (pre 6.7). Decorators should be used instead.

ParameterMeaning
pyObjPython type to be registered.
uriQML element URI.
versionMajorQML component major version.
versionMinorQML component minor version.
qmlNameQML element name.
noCreationReasonReason for the type not being creatable.
creatableWhether the type is creatable.

Returns the metatype id of the registered type or -1 on failure.

PyObject *Qml::qmlSingletonMacro(PyObject *pyObj)

PySide implementation of the QML_SINGLETON macro (@QmlSingleton decorator).

Marks the Python type pyObj as singleton. The registration happens in a subsequent @QmlElement decorator. Returns pyObj.

void Qml::setQuickRegisterItemFunction(PySide::Qml::QuickRegisterItemFunction function)

Sets the function for registering QQuickItem-derived types. This is called by the QtQuick module.

See also getQuickRegisterItemFunction().