Reputation: 511
I have snippet of code below:
while(ui->listWidget->count() > 0) {
QListWidgetItem* aItem = ui->listWidget->takeItem(0);
}
in which I need to empty a QListWidget (the listWidget
variable above).
Currently it crashes with a segfault if an item is focused inside it.
I assume that is a problem (the focusing part) but I just don't know why.
My end goals are:
clear
method. I admit, I may have missed it, but I have spent several days on this problem.Upvotes: 0
Views: 607
Reputation: 2718
QListWidget::clear()
exists. You might have missed it because it is a slot, not just a public function.
http://qt-project.org/doc/qt-4.8/qlistwidget.html#clear
Upvotes: 1