aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtWidgets
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-30 15:07:27 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2018-11-30 16:04:25 +0000
commit5778103f5c86dc7f95bd79eabc24de4021eb2734 (patch)
tree870a404177f02bcd0288deee090af994de7de7e7 /sources/pyside2/PySide2/QtWidgets
parent0a40640a1882dceb34f601dc818cd64c29612672 (diff)
Move code to snippets and templates
There was still leftover code on the typesystems but not all could be translated to snippets, so it was replace by templates. Task-number: PYSIDE-834 Change-Id: I7dbe2f15171ce6a60137be970312dc80622219c9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/QtWidgets')
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml27
1 files changed, 5 insertions, 22 deletions
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index 13cc6f7cf..dba6c268d 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -1479,46 +1479,29 @@
<modify-argument index="2">
<remove-argument/>
<conversion-rule class="native">
- int %out = PySequence_Size(%PYARG_1);
+ <insert-template name="pysequencesize_int"/>
</conversion-rule>
</modify-argument>
<modify-argument index="3">
<replace-type modified-type="PySequence"/>
<conversion-rule class="native">
- int numItems = PySequence_Size(%PYARG_1);
- Shiboken::AutoArrayPointer&lt;QGraphicsItem*&gt; %out(numItems);
- for (int i=0; i &lt; numItems; i++) {
- %out[i] = %CONVERTTOCPP[QGraphicsItem*](PySequence_Fast_GET_ITEM(%PYARG_1, i));
- }
+ <insert-template name="qgraphicsitem_pysequence"/>
</conversion-rule>
<conversion-rule class="target">
- Shiboken::AutoDecRef object(PyList_New(0));
- for (int i=0, max=numItems; i &lt; max; i++) {
- PyList_Append(object, %CONVERTTOPYTHON[QGraphicsItem*](%in[i]));
- }
- PyObject *%out = object.object();
+ <insert-template name="qgraphicsitem_pyobject"/>
</conversion-rule>
</modify-argument>
<modify-argument index="4">
<replace-type modified-type="PySequence"/>
<conversion-rule class="target">
- Shiboken::AutoDecRef option_object(PyList_New(0));
- for (int i=0, max=numItems; i &lt; max; i++) {
- const QStyleOptionGraphicsItem* item = &amp;%in[i];
- PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](item));
- }
- PyObject* %out = option_object.object();
+ <insert-template name="qstyleoptiongraphicsitem_pyobject"/>
</conversion-rule>
<conversion-rule class="native">
- int numOptions = PySequence_Size(%PYARG_2);
- Shiboken::AutoArrayPointer&lt;QStyleOptionGraphicsItem&gt; %out(numOptions);
- for (int i=0; i &lt; numOptions; i++) {
- %out[i] = %CONVERTTOCPP[QStyleOptionGraphicsItem](PySequence_Fast_GET_ITEM(%PYARG_1, i));
- }
+ <insert-template name="pysequence_qstyleoptiongraphicsitem"/>
</conversion-rule>
</modify-argument>
</modify-function>