【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);
相关推荐
用户805533698035 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
xcyxiner5 天前
DicomViewer (vcpkg Windows和ubuntu编译)7
qt
Quz10 天前
QML Hello World 入门示例
qt
xcyxiner13 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner13 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner14 天前
DicomViewer (添加模型类)3
qt
xcyxiner14 天前
DicomViewer (目录调整) 2
qt
xcyxiner14 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
LDR00616 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
雪碧聊技术16 天前
Tree.js是什么?一文讲透
开发语言·javascript·ecmascript