summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-10-20 18:07:49 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-12-09 19:25:36 -0300
commitc1a0865b2abbf8dd19fc1e51b73288d93b5c8d0f (patch)
tree9cee82cb29b8a1bc4e41de6d14f2f34c3cb75648
parent1c109e3126be05cc47fa472804b8a93b45614e5b (diff)
downloadpyside-c1a0865b2abbf8dd19fc1e51b73288d93b5c8d0f.tar.gz
pyside-c1a0865b2abbf8dd19fc1e51b73288d93b5c8d0f.tar.xz
pyside-c1a0865b2abbf8dd19fc1e51b73288d93b5c8d0f.zip
Added converter for primitive type QModelIndexList.
-rw-r--r--PySide/QtCore/typesystem_core.xml35
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml1
-rw-r--r--PySide/typesystem_templates.xml18
3 files changed, 35 insertions, 19 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 0555547..ea77ddc 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -516,23 +516,6 @@
}
</inject-code>
- <template name="cpplist_to_pylist_convertion">
- PyObject* %out = PyList_New((int) %in.size());
- %INTYPE::const_iterator it = %in.begin();
- for (int idx = 0; it != %in.end(); ++it, ++idx) {
- %INTYPE_0 cppItem(*it);
- PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
- }
- return %out;
- </template>
- <template name="pyseq_to_cpplist_convertion">
- for (int i = 0; i &lt; PySequence_Size(%in); i++) {
- Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
- %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
- %out &lt;&lt; cppItem;
- }
- </template>
-
<primitive-type name="QStringList">
<include file-name="QStringList" location="global"/>
<conversion-rule file="qstringlist_conversions.h">
@@ -551,6 +534,24 @@
</conversion-rule>
</primitive-type>
+ <primitive-type name="QModelIndexList">
+ <include file-name="qabstractitemmodel.h" location="global"/>
+ <conversion-rule>
+ <native-to-target>
+ <insert-template name="cpplist_to_pylist_convertion">
+ <replace from="%INTYPE_0" to="QModelIndex" />
+ </insert-template>
+ </native-to-target>
+ <target-to-native>
+ <add-conversion type="PySequence">
+ <insert-template name="pyseq_to_cpplist_convertion">
+ <replace from="%OUTTYPE_0" to="QModelIndex" />
+ </insert-template>
+ </add-conversion>
+ </target-to-native>
+ </conversion-rule>
+ </primitive-type>
+
<container-type name="QSet" type="set">
<include file-name="QSet" location="global"/>
<conversion-rule file="qset_conversions.h">
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 6a64add..4ebccf6 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -2216,7 +2216,6 @@
<object-type name="QItemSelectionModel">
<enum-type name="SelectionFlag" flags="SelectionFlags"/>
</object-type>
- <primitive-type name="QModelIndexList"/>
<object-type name="QListView">
<enum-type name="Flow"/>
<enum-type name="LayoutMode"/>
diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml
index afad4bc..bf7abd1 100644
--- a/PySide/typesystem_templates.xml
+++ b/PySide/typesystem_templates.xml
@@ -381,5 +381,21 @@
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
</template>
-</typesystem>
+ <template name="cpplist_to_pylist_convertion">
+ PyObject* %out = PyList_New((int) %in.size());
+ %INTYPE::const_iterator it = %in.begin();
+ for (int idx = 0; it != %in.end(); ++it, ++idx) {
+ %INTYPE_0 cppItem(*it);
+ PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
+ }
+ return %out;
+ </template>
+ <template name="pyseq_to_cpplist_convertion">
+ for (int i = 0; i &lt; PySequence_Size(%in); i++) {
+ Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
+ %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
+ %out &lt;&lt; cppItem;
+ }
+ </template>
+</typesystem>