How to clear selection of QListView item using QModelIndex?



  • How to clear selection of a QListView item with respect to a selected QModelIndex? QListView has an API which clears all selected items where as I want to clear selection at a particular QModelIndex.


  • Moderators

    do i understand you right, that you want to remain the existing selection but only want to exclude a given model index if it is selected?

    If so you can do this:
    @
    view->selectionModel()->select ( index, QItemSelectionModel::Deselect );
    @



  • Thanks a lot!! It worked!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.