一、头文件
#include <QMessageBox> //提示对话框
二、业务代码
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->actionopen,&QAction::triggered,this,[=](){
QMessageBox::about(this,"about","++++++++++");
int a = QMessageBox::critical(this,"error","系统文件错误!!",QMessageBox::Ok | QMessageBox::Save);
if(a == QMessageBox::Ok){
qDebug() << "QMessageBox::Ok";
}
});