How to clear the selection of QListView when multiple items are selected?

后端 未结 2 1387

I am working on a Qt App where I have a QListView. There are few items present in the list. My application requires items to be rearranged according to user\'s choice. Every

2条回答
  •  没有蜡笔的小新
    2021-01-20 12:12

    Use

    void QAbstractItemView::clearSelection() [slot]
    

    to clear selection

    Also, all views have a selection model you can access through:

    QItemSelectionModel * QAbstractItemView::selectionModel() const
    

    that allows doing a lot more things selecting

    Look at Handling selections in item views

    Another thing ...

    #ifdef QT_NO_DEBUG
    

    means release

    #ifndef QT_NO_DEBUG
    

    would be debug mode, and im sure, it will not compile the code you pasted

提交回复
热议问题