void MainWindow::on_action_Del_triggered() { QList<QListWidgetItem*> selectedItems = ui->listWidget->selectedItems(); if (selectedItems.count() > 0) { if (QMessageBox::Yes == QLibX::QMessageBoxEx::GetInstance()->question(this,"删除确认", QString("确认删除 %1 个项目?").arg(QString::number(selectedItems.count())),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes)) { foreach (QListWidgetItem* var, selectedItems) { ui->listWidget->removeItemWidget(var); selectedItems.removeOne(var); delete var; } } } }