如何删除 QListWidget 中的所有选定项目?
QListWidget::selectedItems 返回 QListWidgetItem 的列表,但我找到的唯一用于删除项目的函数是 takeItem,它只接受索引,并且 selectedIndexes 函数受到保护。
QListWidget::selectedItems returns a list of QListWidgetItem, but the only function for removing an item that I found is takeItem, which accepts only indexes, and selectedIndexes function is protected.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试
Try
迭代 SelectedItemsList:
我认为
也可能有效
Iterate through the SelectedItemsList:
I think
may also work
ui->listWidget->clear();
会做asof qt5
ui->listWidget->clear();
will do asof qt5