【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);
相关推荐
吃好睡好便好1 分钟前
在Matlab中绘制峰值图
开发语言·学习·算法·matlab·信息可视化
兩尛7 分钟前
std::shared_mutex、std::mutex和std::recursive_mutex是什么锁
开发语言·c++·算法
A-刘晨阳8 分钟前
用树莓派搭一个弱网模拟网关,让你的应用在2G、高延迟、丢包环境下跑一遍
开发语言·php
流年如夢9 分钟前
类和对象(上)
android·java·开发语言
kyle~15 分钟前
查找---插值查找(二分查找的改进版本)
开发语言·c++
高翔·权衡之境17 分钟前
主题7:缓存与队列——速度不匹配的通用解
开发语言·人工智能·物联网·缓存·信息与通信·信号处理
:12129 分钟前
java面试
java·开发语言·面试
lsx20240633 分钟前
Ruby 注释
开发语言
Hunter_pcx36 分钟前
ubuntu:内存假泄漏
linux·运维·服务器·开发语言·c++·人工智能·ubuntu
我在人间贩卖青春40 分钟前
重学Qt——模型视图结构
qt