PDA

View Full Version : Exist a 'fullpath' property for an QtreeWidgetitem ???



tonnot
22nd July 2011, 11:54
I dont find a fullpath property for an item selected on a QTreeWidget.
Any help ? It does not exist ?
Have I to get the parents to build the path myself ?

alireza.mirian
22nd July 2011, 13:10
No. There is no method. but it's better to write your own subclass of QTreeWidgetItem and use it instead of writing related code more than one time in your code.

QList<QTreeWidgetItem *> myTreeWidgetItem:: pathToRoot(){

QTreeWidgetItem * current = this;
QList<QTreeWidgetItem*> ret;
while(current)
{

ret.push_back(current);
current = current.parent();
}
return ret;

}