How to clear all items of QListView

Mohammad Reza  Ramezani picture Mohammad Reza Ramezani · Sep 3, 2015 · Viewed 10.2k times · Source

I searched a lot but I could not understand how to clear all items of QListView?

I used QStringListModel and QStringList to fill it.

Answer

cmannett85 picture cmannett85 · Sep 3, 2015

You can either use model.setStringList( QStringList{} ), or manually delete the rows with model.removeRows( 0, model.rowCount() ).