下面这些消息对话框的参数可以按自己的需求进行填写。
比如参1的 this 可以换成 NULL
参2是对话框的名称,即左上角的文字
参3是对话框显示的内容
参4是对话框带的按钮类型,用 | 可以同时添加多个
先添加头文件
#include <QMessageBox>
然后就可以直接使用下面各种消息盒了
QMessageBox::question(this,"Help","This is a help box",QMessageBox::YesAll);
QMessageBox::critical(this,"Error","This is a Error box",QMessageBox::No | QMessageBox::Ok | QMessageBox::YesToAll);
QMessageBox::information(this,"Info","This is an information box", QMessageBox::Yes | QMessageBox::No);