Sollyu

导航

 
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;
            }
        }
    }
}

  

posted on 2014-04-22 17:30  sollyu  阅读(3150)  评论(0编辑  收藏  举报