diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-14 10:37:10 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-16 14:59:36 +0200 |
commit | b6eaa63a81654459827851a261ad50829cc511ba (patch) | |
tree | c72b3afbe93e4897be5381ec5e1d3f294cef9e8c /sources/pyside2/PySide2 | |
parent | dedbc42b569d0dc25de10712168b99d0844c8e50 (diff) |
Remove dependency of the QtQml module header on pysideqmlregistertype.h
Make it possible to inject code into module headers by
specifying "declaration" on type system code snippets.
Use that to insert the struct definition into pyside2_qtqml_python.h
and remove the include. Add the required includes via code injection
into the wrapper and extra includes for the types.
Fixes: PYSIDE-1381
Change-Id: I8dfda4c33d66f56e8fb516e1b174cc43664ca318
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2')
-rw-r--r-- | sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h | 5 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtQml/typesystem_qml.xml | 18 |
2 files changed, 16 insertions, 7 deletions
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h index e94ea043f..536348aa3 100644 --- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h +++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h @@ -73,11 +73,6 @@ int qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int vers // Volatile Bool Ptr type definition. -typedef struct { - PyObject_HEAD - volatile bool flag; -} QtQml_VolatileBoolObject; - PyAPI_FUNC(PyTypeObject *) QtQml_VolatileBoolTypeF(void); #define VolatileBool_Check(op) (Py_TYPE(op) == QtQml_VolatileBoolTypeF()) diff --git a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml index 57979f63f..0a12d44cf 100644 --- a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml +++ b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml @@ -44,10 +44,22 @@ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/> <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/> + <inject-code class="target" position="declaration"> + // Volatile Bool Ptr type definition. + + typedef struct { + PyObject_HEAD + volatile bool flag; + } QtQml_VolatileBoolObject; + </inject-code> + + <inject-code class="native" position="beginning"> + #include "pysideqmlregistertype.h" + </inject-code> + <!-- This is to inform the generator that the VolatileBool python type exists --> <custom-type name="VolatileBool"/> <primitive-type name="bool volatile" target-lang-api-name="VolatileBool"> - <include file-name="pysideqmlregistertype.h" location="local"/> <!-- No conversion rules are specified here, because the generator does not handle pointer to primitive types without function adjustment. See commit ff0b861b59b41387e771d9cd565e13de8b2750d1 or search for changePStr @@ -85,7 +97,6 @@ <enum-type identified-by-value="QML_HAS_ATTACHED_PROPERTIES"> <extra-includes> <include file-name="QtQml" location="global"/> - <include file-name="pysideqmlregistertype.h" location="local"/> </extra-includes> </enum-type> @@ -159,6 +170,9 @@ <enum-type name="Status"/> </object-type> <object-type name="QQmlIncubationController"> + <extra-includes> + <include file-name="pysideqmlregistertype.h" location="local"/> + </extra-includes> <modify-function signature="incubateWhile(volatile bool*,int)" allow-thread="yes"> <modify-argument index="1"> <!-- The replace type is needed to use the VolatileBool_Check macro instead of |