Is there a way to get and change the active row in a QTreeView (not QTreeWidget)? By active, I mean the row with the focus highlight, not the selected row. In the paint event, I can use QStyle.State_HasFocus to get the active row, but this doesn’t seem to work elsewhere.
Is there a way to get and change the active row in a QTreeView
Share
You can get/set the active row with the
currentIndex()andsetCurrentIndex()functions that you can find in bothQTreeViewandQItemSelectionModel(the latter is returned byQTreeView.selectionModel()).And despite its name, the
QItemSelectionModelhandles the view current item, and the view selection independently.