[PyQt] selecting an item in qtreewidget
Jason Rahm
J.Rahm at F5.com
Tue May 3 20:27:15 BST 2011
Newbie question...I'm stuck on how to select an item in my qtreewidget. This loop populates my tree:
item = []
for item in allrules.keys():
hdr = QTreeWidgetItem([item])
self.treeWidget_iRulesList.addTopLevelItem(hdr)
self.treeWidget_iRulesList.expandItem(hdr)
x = []
for x in allrules[item]:
rule = QTreeWidgetItem(hdr, [x])
self.treeWidget_iRulesList.addTopLevelItem(rule)
self.treeWidget_iRulesList.resizeColumnToContents(0)
This is where I'm trying to set the current item, but I'm guessing it's empty since there isn't one already set?
selRule = self.treeWidget_iRulesList.currentItem()
How do I select the last item added, and how do I select one by clicking on it? Sorry to be so basic, I'm really trying to understand the syntax!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110503/2f2339c1/attachment.html>
More information about the PyQt
mailing list