aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-11-04 15:19:02 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-11-04 18:46:12 -0200
commite84308397da7114650b018cef0d0592a98ad152e (patch)
tree57271b82af2f1ce5cf3812dfefe6071a48195a6a /PySide
parent86fa278e1c254db2595b9aa8036cf2b7407d5662 (diff)
Added sequence protocol to QString.
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/typesystem_core.xml26
1 files changed, 26 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 5f12e5404..4e555b7f8 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -934,6 +934,32 @@
%0 = PyUnicode_DecodeUTF8(utf8.data(), utf8.count(), 0);
</inject-code>
</add-function>
+ <add-function signature="__len__">
+ <inject-code class="target" position="beginning">
+ return %CPPSELF.count();
+ </inject-code>
+ </add-function>
+ <add-function signature="__getitem__">
+ <inject-code class="target" position="beginning">
+ if (_i &lt; 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+ } else {
+ return Converter&lt;QString>::createWrapper(new QString(%CPPSELF.at(_i)));
+ }
+ </inject-code>
+ </add-function>
+ <add-function signature="__setitem__">
+ <inject-code class="target" position="beginning">
+ PyObject* args = Py_BuildValue("(iiO)", _i, 1, _value);
+ PyObject* result = PyQString_replace(self, args);
+ Py_DECREF(args);
+ if (result) {
+ Py_DECREF(result);
+ }
+ return !result ? -1 : 0;
+ </inject-code>
+ </add-function>
</value-type>
<value-type name="QLatin1String" />
<value-type name="QStringRef">