作者: shaoliang 2020-04-08 05:29   访问数:924
点击控件--转到槽 添加事件
#include "mainwindow.h" #include "ui_mainwindow.h" #include [QMessageBox] MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { QMessageBox::question(this,"question","This is a question Dialog!",QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Cancel); QMessageBox::information(this,"information","This is a information Dialog!",QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Cancel); QMessageBox::warning(this,"warning","This is a warning Dialog!",QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Cancel); QMessageBox::critical(this,"critical","This is a critical Dialog!",QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Cancel); QMessageBox::about(this,"about","This is a about Dialog!"); }