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.
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?
Qt Code:
int MyTree::currentRow(){ int ind = 0; if(item==wi) return ind; ind++; } return -1; }To copy to clipboard, switch view to plain text mode
I think you need to use this method:
Qt Code:
int pos = treeWidget->indexOfTopLevelItem ( treeWidget->currentItem())To copy to clipboard, switch view to plain text mode
May be it can help a bit.
_pKeywordSummeryTree->selectionModel()->select(_pKeywordSummeryTree->model()->index(_pKeywordSummeryTree ->indexOfTopLevelItem(item),0),QItemSelectionModel: :Select);
Bookmarks