diff options
-rw-r--r-- | PySide/QtCore/typesystem_core_common.xml | 2 | ||||
-rw-r--r-- | PySide/typesystem_templates.xml | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml index 5ef1466fc..4a5e62672 100644 --- a/PySide/QtCore/typesystem_core_common.xml +++ b/PySide/QtCore/typesystem_core_common.xml @@ -603,7 +603,7 @@ </native-to-target> <target-to-native> <add-conversion type="PySequence"> - <insert-template name="pyseq_to_cpplist_convertion"/> + <insert-template name="pyseq_to_cppvector_conversion"/> </add-conversion> </target-to-native> </conversion-rule> diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 2903ae408..61b1471de 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -413,6 +413,15 @@ %out << cppItem; } </template> + <template name="pyseq_to_cppvector_conversion"> + int the_size = PySequence_Size(%in); + %out.reserve(the_size); + for (int i = 0; i < the_size; ++i) { + Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i)); + %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); + %out << cppItem; + } + </template> <template name="checkPyCapsuleOrPyCObject_func"> static bool checkPyCapsuleOrPyCObject(PyObject* pyObj) |