[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QTreeWidget invisible root item
From:       Baz Walter <bazwal () ftml ! net>
Date:       2009-10-26 18:42:28
Message-ID: 4AE5ED94.5060808 () ftml ! net
[Download RAW message or body]

Taylor Carrasco wrote:
> The situation is - I have many "root" nodes coming from Maya, all going to
> be displayed in column 0, and their subsequent row, with a parent/child
> relationship (obviously the roots have no parent). But my question was
> related to whether I should bother with this "invisible root node",
> attaching parenting my Maya root nodes under the invis root, or if I need to
> create my own, or if I should create one like you've shown.

none of the above :)

the easiest way to create top level nodes is like this:

     top_node0 = QTreeWidgetItem(mytreewidget)

or perhaps like this:

     top_node1 = QTreeWidgetItem()
     mytreewidget.insertTopLevelItem(1, top_node1)

whenever a top level node is inserted, the invisible root item is 
automatically set as parent. but the invisible root item only really 
becomes useful *after* the tree of items has been created.

the qt docs explain pretty nicely what sorts of uses it can be put to:

http://doc.trolltech.com/4.5/qtreewidget.html#invisibleRootItem

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic