summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-15 17:04:30 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-15 18:19:46 -0300
commitd75bd8367d26e4049b6748cc001ec7482fbda832 (patch)
tree985fcf6fe08349e89583cc33eeea795bc3794a9e
parent5c9afb798ecc9ec29622464c9c96909a2e79f220 (diff)
downloadpyside-d75bd8367d26e4049b6748cc001ec7482fbda832.tar.gz
pyside-d75bd8367d26e4049b6748cc001ec7482fbda832.tar.xz
pyside-d75bd8367d26e4049b6748cc001ec7482fbda832.zip
Created function value to class QTreeWidgetItemIterator using the
operator *. Fixes bug #400. Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml13
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_400.py26
3 files changed, 38 insertions, 2 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 4ebef94..09f66d9 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -518,11 +518,20 @@
</modify-function>
</value-type>
<value-type name="QTreeWidgetItemIterator" >
+ <modify-function signature="QTreeWidgetItemIterator(QTreeWidget *, QFlags&lt;QTreeWidgetItemIterator::IteratorFlag&gt;)">
+ <inject-code class="target" position="end">
+ Shiboken::setParent(%PYARG_1, (PyObject*)sbkSelf);
+ </inject-code>
+ </modify-function>
+ <add-function signature="value()" return-type="QTreeWidgetItem*">
+ <inject-code>
+ %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%CPPSELF.operator*());
+ SbkBaseWrapper_setOwnership(%PYARG_0, false);
+ </inject-code>
+ </add-function>
<enum-type name="IteratorFlag" flags="QTreeWidgetItemIterator::IteratorFlags"/>
<modify-function signature="operator++(int)" remove="all"/>
<modify-function signature="operator--(int)" remove="all"/>
- <modify-function signature="operator+=(int)" remove="all"/>
- <modify-function signature="operator-=(int)" remove="all"/>
<modify-function signature="operator++()" remove="all"/>
<modify-function signature="operator--()" remove="all"/>
<modify-function signature="operator*()const" remove="all"/>
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index f40ebfd..4a293f2 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -11,6 +11,7 @@ PYSIDE_TEST(bug_338.py)
PYSIDE_TEST(bug_363.py)
PYSIDE_TEST(bug_367.py)
PYSIDE_TEST(bug_389.py)
+PYSIDE_TEST(bug_400.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
diff --git a/tests/QtGui/bug_400.py b/tests/QtGui/bug_400.py
new file mode 100644
index 0000000..0038a3e
--- /dev/null
+++ b/tests/QtGui/bug_400.py
@@ -0,0 +1,26 @@
+''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389'''
+
+import unittest
+from helper import UsesQApplication
+from PySide.QtGui import QTreeWidgetItemIterator, QTreeWidgetItem, QTreeWidget
+
+class BugTest(UsesQApplication):
+ def testCase(self):
+ treeWidget = QTreeWidget()
+ treeWidget.setColumnCount(1)
+ items = []
+ for i in range(10):
+ items.append(QTreeWidgetItem(None, ["item: %i" % i]))
+
+ treeWidget.insertTopLevelItems(0, items);
+ _iter = QTreeWidgetItemIterator(treeWidget)
+ index = 0
+ while(_iter.value()):
+ item = _iter.value()
+ self.assert_(item is items[index])
+ index += 1
+ _iter += 1
+
+
+if __name__ == '__main__':
+ unittest.main()