Solved compare indexes of selected model and the model
-
i have a tree view and wanna know whether the first index is selected.
if i doauto lst = TreeView->selectionModel()->selectedIndexes(); if (lst.front() == TreeView->model()->index(0, 0)) { // doesn't reach here because operator== of QModelndex compares the corresponding models too }
what can i do?
-
@user4592357
Does this work?TreeView->selectionModel()->isSelected( TreeView->model()->index(0, 0) )
-
@JonB
it didn't work for me :(
EDIT: i usedisRowSelected()
and that worked