aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtScript/typesystem_script.xml
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-07-28 16:37:12 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:41 -0300
commit8d8c4cf308c6e066a4e625ff2a05c11e7b9fba0b (patch)
tree7267e71f96b4b4ddd915e732e5ad23867a28c571 /PySide/QtScript/typesystem_script.xml
parentd912655b5a00f44dc26be4ec6821c5e0aed1ab3c (diff)
Fix bug 923 - "Make QScriptValue (or QScriptValueIterator) implement the Python iterator protocol"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide/QtScript/typesystem_script.xml')
-rw-r--r--PySide/QtScript/typesystem_script.xml23
1 files changed, 22 insertions, 1 deletions
diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml
index 738c44bda..05afba262 100644
--- a/PySide/QtScript/typesystem_script.xml
+++ b/PySide/QtScript/typesystem_script.xml
@@ -72,7 +72,28 @@
}
</inject-code>
</add-function>
+ <add-function signature="__iter__()" return-type="PyObject*">
+ <inject-code>
+ %PYARG_0 = Shiboken::createWrapper(new QScriptValueIterator(*%CPPSELF), true, true);
+ </inject-code>
+ </add-function>
</value-type>
- <object-type name="QScriptValueIterator"/>
+ <object-type name="QScriptValueIterator">
+ <add-function signature="__iter__()" return-type="PyObject*">
+ <inject-code>
+ <insert-template name="__iter__" />
+ </inject-code>
+ </add-function>
+ <add-function signature="__next__()" return-type="PyObject*">
+ <inject-code>
+ if (%CPPSELF.hasNext()) {
+ %CPPSELF.next();
+ %PYARG_0 = Shiboken::makeTuple(%CPPSELF.name(), %CPPSELF.value().toVariant());
+ } else {
+ PyErr_SetNone(PyExc_StopIteration);
+ }
+ </inject-code>
+ </add-function>
+ </object-type>
</typesystem>