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

∥☆過路亽.° 提交于 2019-12-02 01:45:57

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

Use the QAbstractItemView::clearSelection function.

If you have subclassed QListView you can just call it with clearSelection();

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!