【Qt】QMessageBox 各种对话框的默认显示效果

1. 函数原型

c 复制代码
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

2.2 aboutQt

2.3 critical

2.4 information

2.5 question

2.6 warning

3. 代码

c 复制代码
	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);
相关推荐
跟着珅聪学java几秒前
以下是使用JavaScript动态拼接数组内容到HTML的多种方法及示例:
开发语言·前端·javascript
小鸡吃米…1 分钟前
Python - 扩展
开发语言·python
斯文by累4 分钟前
浅析:Scheme开发语言
开发语言
IT艺术家-rookie5 分钟前
golang-- sync.WaitGroup 和 errgroup.Group 详解
开发语言·后端·golang
树下水月7 分钟前
Go语言编码规范
开发语言·后端·golang
无限大.8 分钟前
为什么“云计算“能改变世界?——从本地计算到云端服务
开发语言·云计算·perl
草莓熊Lotso11 分钟前
Python 流程控制完全指南:条件语句 + 循环语句 + 实战案例(零基础入门)
android·开发语言·人工智能·经验分享·笔记·后端·python
laozhoy111 分钟前
深入理解Golang中的锁机制
开发语言·后端·golang
雾岛听蓝14 分钟前
C++ 模板初阶
开发语言·c++
小杰帅气15 分钟前
智能指针喵喵喵
开发语言·c++·算法