[PySide] Moving up a tree

John Ehresman jpe at wingware.com
Thu Jan 31 20:35:32 CET 2013


On 1/31/13 1:46 PM, litltbear at gmail.com wrote:
> I'm using QTreeWidget, QTreeView, and QTreeWidgetItems.
> 
> I'm trying to add an item to the tree.  So if I select an item, I need
> to know where in the tree I am and also the root of that sub tree.

You can get the list of items selected via the selectedIndexes() method
on the tree view.  Each element returned will be a QModelIndex instance;
see http://qt-project.org/doc/qt-4.8/qmodelindex.html  The parent()
method will return the QModelIndex of the parent.

Cheers,

John




More information about the PySide mailing list