This is probably an easy question (except for me
), but how do you get a QTreeWidgetItem's parents column number? I have QTreeWidget that when a user selects an item, I am building a concatenated string of all of that selected item's parent's names. I can get the original item's name that is selected from currentColumn().
...
foreach(item, selected)
{
attrName = item->text(mAttributeTreeWidget->currentColumn());
if(item->parent())
{
parentName = parent->text(??));
if(parent->parent())
{
platName = plat->text(??);
if(plat->parent())
{
runName = run->text(??);
}
}
}
}
QString fullName
= runName
+ "::" + platName
+ "::" + attrName;
...
...
foreach(item, selected)
{
attrName = item->text(mAttributeTreeWidget->currentColumn());
if(item->parent())
{
QTreeWidgetItem * parent = item->parent();
parentName = parent->text(??));
if(parent->parent())
{
QTreeWidgetItem * plat = parent->parent();
platName = plat->text(??);
if(plat->parent())
{
QTreeWidgetItem * run = plat->parent();
runName = run->text(??);
}
}
}
}
QString fullName = runName + "::" + platName + "::" + attrName;
...
To copy to clipboard, switch view to plain text mode
Bookmarks