Qt学习笔记 QMessageBox

简介: Qt的几种MessageBox 1.Infomation类型 QMessageBox::information(this,tr("hello"),tr("title")); 2.Question类型 QMessageBox::StandardButton returnBt...

Qt的几种MessageBox

1.Infomation类型

QMessageBox::information(this,tr("hello"),tr("title"));

2.Question类型

    QMessageBox::StandardButton returnBtn;
    returnBtn = QMessageBox::question(this,tr("hello have problem?"),tr("error!"),QMessageBox::Yes|QMessageBox::No);
    if(returnBtn==QMessageBox::Yes)
    {
        QMessageBox::information(this,tr("Yes!"),tr("error"));
    }

 

3.Warning类型

QMessageBox::warning(this,tr("warning!"),tr("warning!"));

 

4.自定义类型

    QMessageBox msg;
    msg.setText("customer!");
    msg.setWindowTitle(tr("titleHaHa"));
    msg.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);
    msg.exec();

 

目录
相关文章
|
5月前
|
数据安全/隐私保护
22 QT - QLineEdit
22 QT - QLineEdit
26 0
|
5月前
|
存储 前端开发 Cloud Native
C++Qt QSS要注意的坑
C++Qt QSS要注意的坑
|
3月前
Qt6学习笔记五(自定义对话框、QMessageBox、QColorDialog、QFileDialog、QFontDialog)
Qt6学习笔记五(自定义对话框、QMessageBox、QColorDialog、QFileDialog、QFontDialog)
41 0
|
18天前
|
C++ 索引
【Qt 学习笔记】如何在Qt中打印日志 | qDebug的使用 | Assistant的使用
【Qt 学习笔记】如何在Qt中打印日志 | qDebug的使用 | Assistant的使用
18 0
|
4月前
|
存储 自然语言处理 API
QT基础教程(QDebug和QString)
QT基础教程(QDebug和QString)
36 0
|
11月前
|
开发者
Qt之标准对话框(QMessageBox、QFileDialog)
Qt之标准对话框(QMessageBox、QFileDialog)
117 0
|
网络协议 Java PHP
|
数据安全/隐私保护 C++
Qt 5——常用控件(QLable、QLineEdit、)
Qt 5——常用控件(QLable、QLineEdit、)
372 0
Qt 5——常用控件(QLable、QLineEdit、)
Qt之QSS(QTreeView)
简述 QTreeView 作为一个树形控件,我们经常用到,只要对样式熟悉,可以做出特别漂亮的特效。 简述 自定义 QTreeView 指示器 整行拓展 自定义 QTreeView 交替行的背景色可以使用下面样式代码来定义: QTreeView { alternate-background-color: yellow; } 当鼠标划过
3766 0

推荐镜像

更多