aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-01-27 14:38:43 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-02-16 21:14:05 +0100
commitabb6e8ca90fb2ff0718f7e29d00ebd90bc9f7ccd (patch)
tree29028d7346e0dd19a2598c7aeaffe13af1fc2487 /sources/pyside6/PySide6
parenta54272ecfa6ce69e201a72678da26f7f92238ac5 (diff)
Add the QmlAttached decorator
[ChangeLog][PySide6] The QmlAttached decorator has been added. Task-number: PYSIDE-1709 Change-Id: I0301ecc7a9bc7a1b798095e8972b2fe4addf2eaf Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/PySide6')
-rw-r--r--sources/pyside6/PySide6/QtQml/typesystem_qml.xml6
-rw-r--r--sources/pyside6/PySide6/glue/qtqml.cpp5
2 files changed, 11 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
index b5c8840bf..029bdc2c7 100644
--- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
+++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
@@ -58,6 +58,7 @@
<inject-code class="native" position="beginning">
#include &lt;pysideqml.h&gt;
#include &lt;pysideqmlregistertype.h&gt;
+ #include &lt;pysideqmlattached.h&gt;
#include "pysideqmlvolatilebool.h"
</inject-code>
@@ -78,6 +79,11 @@
<value-type name="atomic" generate="no"/>
</namespace-type>
+ <add-function signature="qmlAttachedPropertiesObject(PyTypeObject*,QObject*,bool=true)"
+ return-type="QObject*">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlattachedpropertiesobject"/>
+ </add-function>
+
<add-function signature="qmlRegisterType(PyTypeObject,const char*,int,int,const char*)" return-type="int">
<inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistertype"/>
</add-function>
diff --git a/sources/pyside6/PySide6/glue/qtqml.cpp b/sources/pyside6/PySide6/glue/qtqml.cpp
index 3931e4d51..f9e0e15d4 100644
--- a/sources/pyside6/PySide6/glue/qtqml.cpp
+++ b/sources/pyside6/PySide6/glue/qtqml.cpp
@@ -42,6 +42,11 @@ const QByteArray message = %CPPSELF.toString().toUtf8();
%PYARG_0 = Shiboken::String::fromCString(message.constData());
// @snippet qmlerrror-repr
+// @snippet qmlattachedpropertiesobject
+auto *%0 = PySide::Qml::qmlAttachedPropertiesObject(%ARGUMENT_NAMES);
+%PYARG_0 = %CONVERTTOPYTHON[QObject*](%0);
+// @snippet qmlattachedpropertiesobject
+
// @snippet qmlregistertype
int %0 = PySide::Qml::qmlRegisterType(%ARGUMENT_NAMES);
%PYARG_0 = %CONVERTTOPYTHON[int](%0);