How do I remove all the selected items in a QListWidget?

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.




Iterate through the SelectedItemsList:

QList<QListWidgetItem *> itemList = widget->selectedItems();
for (int i=0; i<itemList.size(); i++) {

I think


may also work

ui->listWidget->clear(); will do asof qt5

Need Your Help

OData "where ID in list" query

linq collections filter odata

I have an OData service where I'm trying to filter by a list of IDs; the SQL equivalent would be something like:

ASP.NET MVC optional field being treated as required

I have this field that for some reason when I click on submit, gets a validation message that the field is required.