diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-02-19 13:21:44 +0100 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2025-02-20 11:23:48 +0000 |
| commit | 526e3ffe4c3e63e97508443e6bc39376bbdf9df9 (patch) | |
| tree | 8dbd4a4a0d9d5aed77e1e84324e58823a9370fa2 /sources/pyside6 | |
| parent | 3d2596dd41cbd3754e824ccab15f13ca9c659ff1 (diff) | |
QtWidgets: Use the new sequence templates
Use templates introduced by e3631c3322d28447068de3a874055ff937b237c4.
Task-number: PYSIDE-3002
Change-Id: I5b7948c83768fa0c03c6b360717d202270ebbc9e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit d7021af1b27177a38f72fa0b2febd5233309d786)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources/pyside6')
| -rw-r--r-- | sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml | 9 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/templates/widgets_common.xml | 18 |
2 files changed, 8 insertions, 19 deletions
diff --git a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml index 9e326a13a..7887d836b 100644 --- a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml @@ -1460,11 +1460,16 @@ <modify-argument index="3"> <replace-type modified-type="PySequence"/> <conversion-rule class="native"> - <insert-template name="qgraphicsitem_pysequence"/> + <insert-template name="pysequence-to-c-array"> + <replace from="%TYPE" to="QGraphicsItem*"/> + </insert-template> </conversion-rule> <conversion-rule class="target"> - <insert-template name="qgraphicsitem_pyobject"/> + <insert-template name="c-array-to-pysequence"> + <replace from="%TYPE" to="QGraphicsItem*"/> + <replace from="%COUNT" to="numItems"/> + </insert-template> </conversion-rule> </modify-argument> diff --git a/sources/pyside6/PySide6/templates/widgets_common.xml b/sources/pyside6/PySide6/templates/widgets_common.xml index 3744ba3e5..7f9a764a3 100644 --- a/sources/pyside6/PySide6/templates/widgets_common.xml +++ b/sources/pyside6/PySide6/templates/widgets_common.xml @@ -15,23 +15,7 @@ Shiboken::Object::setParent(%PYSELF, $PYARG); </template> - <template name="qgraphicsitem_pysequence"> - const Py_ssize_t numItems = PySequence_Size(%PYARG_1); - Shiboken::AutoArrayPointer<QGraphicsItem*> %out(numItems); - for (Py_ssize_t i = 0; i < numItems; ++i) { - Shiboken::AutoDecRef _arg1(PySequence_GetItem(%PYARG_1, i)); - %out[i] = %CONVERTTOCPP[QGraphicsItem*](_arg1); - } - </template> - - <template name="qgraphicsitem_pyobject"> - Shiboken::AutoDecRef object(PyList_New(0)); - for (int i=0, max=numItems; i < max; i++) { - PyList_Append(object, %CONVERTTOPYTHON[QGraphicsItem*](%in[i])); - } - PyObject *%out = object.object(); - </template> - + <!-- Do pointer conversion here since QStyleOptionGraphicsItem is an "object-type". --> <template name="qstyleoptiongraphicsitem_pyobject"> Shiboken::AutoDecRef option_object(PyList_New(0)); for (int i=0, max=numItems; i < max; i++) { |
