I'm using a QTreeWidget to display a list with two columns, so I only insert toplevel items on it. I only allow the user to select one row. Is there a way to know which row is actually selected? I mean the row number, not the QTreeWidgetItem. Thx.
Printable View
I'm using a QTreeWidget to display a list with two columns, so I only insert toplevel items on it. I only allow the user to select one row. Is there a way to know which row is actually selected? I mean the row number, not the QTreeWidgetItem. Thx.
Maybe something like this?
Code:
int MyTree::currentRow(){ int ind = 0; if(item==wi) return ind; ind++; } return -1; }
I think you need to use this method:
Code:
int pos = treeWidget->indexOfTopLevelItem ( treeWidget->currentItem())
May be it can help a bit.
_pKeywordSummeryTree->selectionModel()->select(_pKeywordSummeryTree->model()->index(_pKeywordSummeryTree:D ->indexOfTopLevelItem(item),0),QItemSelectionModel: :Select);