summaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-05-17 19:55:05 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-05-18 14:29:29 -0300
commiteb133c76b8fc51399f2ca93c33346fa3bb64850e (patch)
treef4c0637e1dbcd13437e4fd7fc8fda29bf869ac15 /PySide
parenta859097f565a5b973954eac86f2455ec31801a94 (diff)
downloadpyside-eb133c76b8fc51399f2ca93c33346fa3bb64850e.tar.gz
pyside-eb133c76b8fc51399f2ca93c33346fa3bb64850e.tar.xz
pyside-eb133c76b8fc51399f2ca93c33346fa3bb64850e.zip
Fix bug 803 - "QWebElementCollection.operator[] is not implemented"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtWebKit/typesystem_webkit.xml17
1 files changed, 16 insertions, 1 deletions
diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml
index 45f498e..a021a04 100644
--- a/PySide/QtWebKit/typesystem_webkit.xml
+++ b/PySide/QtWebKit/typesystem_webkit.xml
@@ -175,5 +175,20 @@
<value-type name="QWebElement" since="4.6">
<enum-type name="StyleResolveStrategy"/>
</value-type>
- <value-type name="QWebElementCollection" since="4.6"/>
+ <value-type name="QWebElementCollection" since="4.6">
+ <add-function signature="__len__">
+ <inject-code>
+ return %CPPSELF.count();
+ </inject-code>
+ </add-function>
+ <add-function signature="__getitem__">
+ <inject-code>
+ if (_i &lt; 0 || _i >= %CPPSELF.count()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+ }
+ return %CONVERTTOPYTHON[QWebElement](%CPPSELF.at(_i));
+ </inject-code>
+ </add-function>
+ </value-type>
</typesystem>