【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);
相关推荐
weixin_472339464 小时前
高效处理大体积Excel文件的Java技术方案解析
java·开发语言·excel
枯萎穿心攻击4 小时前
响应式编程入门教程第二节:构建 ObservableProperty<T> — 封装 ReactiveProperty 的高级用法
开发语言·unity·c#·游戏引擎
Eiceblue6 小时前
【免费.NET方案】CSV到PDF与DataTable的快速转换
开发语言·pdf·c#·.net
m0_555762906 小时前
Matlab 频谱分析 (Spectral Analysis)
开发语言·matlab
浪裡遊7 小时前
React Hooks全面解析:从基础到高级的实用指南
开发语言·前端·javascript·react.js·node.js·ecmascript·php
lzb_kkk8 小时前
【C++】C++四种类型转换操作符详解
开发语言·c++·windows·1024程序员节
好开心啊没烦恼8 小时前
Python 数据分析:numpy,说人话,说说数组维度。听故事学知识点怎么这么容易?
开发语言·人工智能·python·数据挖掘·数据分析·numpy
简佐义的博客9 小时前
破解非模式物种GO/KEGG注释难题
开发语言·数据库·后端·oracle·golang
程序员爱钓鱼9 小时前
【无标题】Go语言中的反射机制 — 元编程技巧与注意事项
开发语言·qt