def testWidgetIterator(self): treeWidget = QTreeWidget() treeWidget.setColumnCount(1) items = [] for i in range(10): items.append(QTreeWidgetItem(None, ['item: %d' % i])) treeWidget.insertTopLevelItems(0, items) index = 0 for it in QTreeWidgetItemIterator(treeWidget): self.assertEqual(it.value().text(0), 'item: %d' % index) index += 1
def _expand_all_fired(self): ctrl = self.control ctrl.expandAll() for item in QTreeWidgetItemIterator(ctrl): item = item.value() try: self._expand_node(item) self._update_icon(item) except AttributeError: pass
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