diff options
-rw-r--r-- | sources/pyside6/PySide6/QtQml/typesystem_qml.xml | 6 | ||||
-rw-r--r-- | sources/pyside6/PySide6/glue/qtqml.cpp | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml index 901240266..b59a6cf00 100644 --- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml +++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml @@ -179,7 +179,11 @@ <modify-function signature="QQmlComponent(QQmlEngine*,QUrl,QQmlComponent::CompilationMode,QObject*)" allow-thread="yes"/> </object-type> <object-type name="QQmlContext"/> - <value-type name="QQmlError"/> + <value-type name="QQmlError"> + <add-function signature="__repr__" return-type="PyObject*"> + <inject-code class="target" position="beginning" file="../glue/qtqml.cpp" snippet="qmlerrror-repr"/> + </add-function> + </value-type> <object-type name="QQmlDebuggingEnabler"> <enum-type name="StartMode"/> </object-type> diff --git a/sources/pyside6/PySide6/glue/qtqml.cpp b/sources/pyside6/PySide6/glue/qtqml.cpp index 99a1c441a..a0a780a07 100644 --- a/sources/pyside6/PySide6/glue/qtqml.cpp +++ b/sources/pyside6/PySide6/glue/qtqml.cpp @@ -37,6 +37,11 @@ ** ****************************************************************************/ +// @snippet qmlerrror-repr +const QByteArray message = %CPPSELF.toString().toUtf8(); +%PYARG_0 = Shiboken::String::fromCString(message.constData()); +// @snippet qmlerrror-repr + // @snippet qmlregistertype int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES); %PYARG_0 = %CONVERTTOPYTHON[int](%0); |