1. 函数原型
void about(QWidget *parent, const QString &title, const QString &text)
void aboutQt(QWidget *parent, const QString &title = QString())
QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)
QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)
QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = StandardButtons(Yes | No), QMessageBox::StandardButton defaultButton = NoButton)
QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)
2. 显示效果
2.1 about
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/6c3eea16b68f4f9bba88ff4b95b139ce.png)
2.2 aboutQt
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/0cae41237dd943299dc077d61c231172.png)
2.3 critical
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/c5a3634ec5474e57a4c31778d6670416.png)
2.4 information
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/2882577642ac454c84900b64d81a56c8.png)
2.5 question
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/e532e3e780d44ddcaf94849521602768.png)
2.6 warning
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/4fc3d934863e480985de70ca2f0649bb.png)
3. 代码
QMessageBox::about(this, "测试", "about");
QMessageBox::aboutQt(this, "aboutQt");
QMessageBox::critical(this, "测试", "critical", QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::information(this, "测试", "information", QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::question(this, "测试", "question", QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::warning(this, "测试", "warning", QMessageBox::Ok, QMessageBox::NoButton);