Added converter for primitive type QModelIndexList.
This commit is contained in:
parent
25638d3f80
commit
8145f2a7e2
3 changed files with 35 additions and 19 deletions
|
|
@ -516,23 +516,6 @@
|
||||||
}
|
}
|
||||||
</inject-code>
|
</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 < PySequence_Size(%in); i++) {
|
|
||||||
Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
|
|
||||||
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
|
|
||||||
%out << cppItem;
|
|
||||||
}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<primitive-type name="QStringList">
|
<primitive-type name="QStringList">
|
||||||
<include file-name="QStringList" location="global"/>
|
<include file-name="QStringList" location="global"/>
|
||||||
<conversion-rule file="qstringlist_conversions.h">
|
<conversion-rule file="qstringlist_conversions.h">
|
||||||
|
|
@ -551,6 +534,24 @@
|
||||||
</conversion-rule>
|
</conversion-rule>
|
||||||
</primitive-type>
|
</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">
|
<container-type name="QSet" type="set">
|
||||||
<include file-name="QSet" location="global"/>
|
<include file-name="QSet" location="global"/>
|
||||||
<conversion-rule file="qset_conversions.h">
|
<conversion-rule file="qset_conversions.h">
|
||||||
|
|
|
||||||
|
|
@ -2216,7 +2216,6 @@
|
||||||
<object-type name="QItemSelectionModel">
|
<object-type name="QItemSelectionModel">
|
||||||
<enum-type name="SelectionFlag" flags="SelectionFlags"/>
|
<enum-type name="SelectionFlag" flags="SelectionFlags"/>
|
||||||
</object-type>
|
</object-type>
|
||||||
<primitive-type name="QModelIndexList"/>
|
|
||||||
<object-type name="QListView">
|
<object-type name="QListView">
|
||||||
<enum-type name="Flow"/>
|
<enum-type name="Flow"/>
|
||||||
<enum-type name="LayoutMode"/>
|
<enum-type name="LayoutMode"/>
|
||||||
|
|
|
||||||
|
|
@ -381,5 +381,21 @@
|
||||||
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
|
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
|
||||||
</template>
|
</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 < PySequence_Size(%in); i++) {
|
||||||
|
Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
|
||||||
|
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
|
||||||
|
%out << cppItem;
|
||||||
|
}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</typesystem>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue