Why can't i remove an item into a QListWidget an item?
void regExp::deleteItem()
{
QList<QListWidgetItem *> listReSelected = ui.listWidgetRE->selectedItems();
ui.
labelOut->setText
("Size: " + QString::number(listReSelected.
size(),
10));
//print the correct vector size for (int i = 0; i < listReSelected.size(); ++i){
ui.labelOut->setText("selected: " + listReSelected.at(i)->text()); //print the correct name
ui.listWidgetRE->removeItemWidget(listReSelected.at(i)); //it doesn't work
}
}
void regExp::deleteItem()
{
QList<QListWidgetItem *> listReSelected = ui.listWidgetRE->selectedItems();
ui.labelOut->setText("Size: " + QString::number(listReSelected.size(), 10)); //print the correct vector size
for (int i = 0; i < listReSelected.size(); ++i){
ui.labelOut->setText("selected: " + listReSelected.at(i)->text()); //print the correct name
ui.listWidgetRE->removeItemWidget(listReSelected.at(i)); //it doesn't work
}
}
To copy to clipboard, switch view to plain text mode
removeItemWidget want a QListWidgetItem* and i'm passing it....
Bookmarks