[PyQt] QTreeWidget itemAt question

Scott Frankel frankel at circlesfx.com
Tue Jul 21 18:47:32 BST 2009


Hello,

What's the proper way to use QTreeWidget's itemAt() method?  I'm  
passing incrementing int values to it, yet it only returns the tree's  
root item.  eg:

		for ii in range(self.treeRowCount):
			item      = self.theTree.itemAt(0, ii)

yields:

ii:       0
item:     <PyQt4.QtGui.QTreeWidgetItem object at 0x59ed0>
text:     rootItem
ii:       1
item:     <PyQt4.QtGui.QTreeWidgetItem object at 0x59ed0>
text:     rootItem
ii:       2
item:     <PyQt4.QtGui.QTreeWidgetItem object at 0x59ed0>
text:     rootItem
ii:       3
item:     <PyQt4.QtGui.QTreeWidgetItem object at 0x59ed0>
text:     rootItem


(See attached for the full, simple code example.)

Ultimately, I want to be able to identify a QTreeWidgetItem by the  
results of its text() so that I can set the tree item's parent for  
branch points.  Note that I'm building simple, small trees from stored  
data sets.  Hence the convenience widget rather than the model-view.

Thanks in advance!
Scott




-------------- next part --------------
A non-text attachment was scrubbed...
Name: treeWidgetTest.py
Type: text/x-python-script
Size: 1974 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090721/da8a9216/treeWidgetTest.bin
-------------- next part --------------







More information about the PyQt mailing list