[PyQt] qtreewidget only printing first character of my strings

Jason Rahm J.Rahm at F5.com
Thu Apr 21 17:18:51 BST 2011


Here's my code:

            selected = None
            self.treeWidget_iRulesList.clear()
            self.treeWidget_iRulesList.setColumnCount(1)
            self.treeWidget_iRulesList.setHeaderLabels(["Rules"])
            self.treeWidget_iRulesList.setItemsExpandable(True)

            for item in allrules.keys():
                #print item
                hdr = QTreeWidgetItem(item)
                self.treeWidget_iRulesList.addTopLevelItem(hdr)
                self.treeWidget_iRulesList.expandItem(hdr)
                for x in allrules[item]:
                    #print x
                    rule = QTreeWidgetItem(hdr, x)
                    self.treeWidget_iRulesList.addTopLevelItem(rule)

If I uncomment my print statements, each string is printed as expected, but in the QTreeWidget, I only get the first character:

-g
----g
----t
----t
-l
----h
----u
----_

And so on.  Any ideas?  Thanks in advance.

Jason

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110421/bc67d421/attachment.html>


More information about the PyQt mailing list