作者:丁可丁可_136 | 来源:互联网 | 2023-09-23 20:56
带选择的窗体QMessageBox::StandardButtonrbQMessageBox::critical(NULL,QString::fromLocal8Bit(提示)
带选择的窗体
QMessageBox::StandardButton rb = QMessageBox::critical(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("确定删除吗?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(rb == QMessageBox::Yes)
{
QPushButton *btn = (QPushButton *) sender();
QString row= btn->property("row").toString();
QString id = btn->property("ids").toString();
Model->removeRow(0);
QString sql="delete from syzbInfo where id=:id";
QSqlQuery query;
query.prepare(sql);
query.bindValue(":id",id);
if(query.exec()){
ui.tableView_syzb->setRowHidden(row.toInt(),true);
getSyzbData(Data::id_cards);
}
}
只有确定按钮的消息窗体
QMessageBox::about(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("添加失败"));