[PyQt] QTreeWidget invisible root item

Taylor Carrasco crackerbunny at gmail.com
Sun Oct 25 20:45:34 GMT 2009

Well, I'm wondering if I should bother with the invisible root item.

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.

On Sun, Oct 25, 2009 at 2:48 AM, Baz Walter <bazwal at ftml.net> wrote:

> Taylor Carrasco wrote:
>> How do you add an invisible root item?
> by definition, there can only be one root item and that is already provided
> by the treewidget.
> something like this might do what you want:
> myroot = QTreeWidgetItem(mytreewidget)
> mytreewidget.setRootIndex(mytreewidget.indexFromItem(myroot))
> but note that that wont actually replace the invisible root item - it just
> creates a hidden top level item that can be used as the parent of all
> subsequent items.
> (as usual, it would be a lot easier to help if you told us what problem you
> are actually trying to solve...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091025/160532c0/attachment-0001.html

More information about the PyQt mailing list