#include "dialog.h"
#include "ui_dialog.h"
#include<QMessageBox> Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
} Dialog::~Dialog()
{
delete ui;
} void Dialog::on_pushButton_clicked()
{
//info
QMessageBox::information(this,"title here","Text Here");
} void Dialog::on_pushButton_2_clicked()
{
//question
QMessageBox::StandardButton reply;
reply = QMessageBox::information(this,"title here","Do you like cats?",QMessageBox::Yes|QMessageBox::No); if(reply == QMessageBox::Yes)
{
QMessageBox::information(this,"title here","You LOVE cats");
}
} void Dialog::on_pushButton_3_clicked()
{
QMessageBox::warning(this,"title here","Waring");
} void Dialog::on_pushButton_4_clicked()
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this,"My Title","My Test here", QMessageBox::YesToAll|QMessageBox::Yes|QMessageBox::No|QMessageBox::NoToAll); if(reply == QMessageBox::Yes)
{
QMessageBox::information(this,"title here","YES");
}
}

  

QMessageBox的更多相关文章

  1. QT添加二次确认功能,QMessageBox的使用

    对于一些重要的操作需要让用户再次确认一次,给出几个基本的实例 是和否 switch( QMessageBox::warning(NULL, "warning",QString::f ...

  2. Qt学习笔记 QMessageBox

    Qt的几种MessageBox 1.Infomation类型 QMessageBox::information(this,tr("hello"),tr("title&qu ...

  3. QMessageBox 使用方法

    在Qt中经常需要弹出窗口,QMessageBox可以实现此功能,一共有三种窗口,information, question, 和 warning,critical, about分别对应感叹号,问号和叉 ...

  4. qt QMessageBox QInputDialog

    最近用到了QMessgaeBox和QInputDialog,QMessageBox用于提示,警告等消息,QInputDialog给用户弹出输入对话框. 参考链接 http://chenboqiang. ...

  5. QMessageBox中按钮的汉化

    方法一:直接添加汉语按钮: QMessageBox mess(QMessageBox::Question, "删除提示", "确认删除所选组件?", NULL) ...

  6. QMessageBox类学习:

    先来看一下最熟悉的QMessageBox::information.我们在以前的代码中这样使用过:   QMessageBox::information(NULL, "Title" ...

  7. Qt之国际化(系统文本-QMessageBox按钮、QLineEdit右键菜单等)

    简介 使用Qt的时候,经常会遇到英文问题,例如:QMessageBox中的按钮.QLineEdit.QSpinBox.QScrollBar中的右键菜单等.通常情况下,我们软件都不会是纯英文的,那么如何 ...

  8. 【Qt】Qt之自定义界面(QMessageBox)【转】

    简述 通过前几节的自定义窗体的学习,我们可以很容易的写出一套属于自己风格的界面框架,通用于各种窗体,比如:QWidget.QDialog.QMainWindow. 大多数窗体的实现都是采用控件堆积来完 ...

  9. 【Qt】Qt国际化(系统文本-QMessageBox按钮、QLineEdit右键菜单等)【转】

    简介 使用Qt的时候,经常会遇到英文问题,例如:QMessageBox中的按钮.QLineEdit.QSpinBox.QScrollBar中的右键菜单等.通常情况下,我们软件都不会是纯英文的,那么如何 ...

随机推荐

  1. UVa 3487 & 蜜汁建图

    题意: 有两家公司都想向政府申请某些资源的使用权,并且他们都提供了一些申请列表,列表中含有申请费用和资源种类,同一家公司的申请列表之间不含有重复的资源.政府只可以完整地接受和拒绝谋一份申请列表,问政府 ...

  2. HDU3068最长回文 题解

    题目大意: 求字符串的最长回文子串的长度. 思路: Manacher板题,Hash可能会T.要学习Manacher,可参考https://www.felix021.com/blog/read.php? ...

  3. Leetcode Unique Binary Search Trees

    Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For examp ...

  4. ACM 交换输出

    交换输出 时间限制:3000 ms  |  内存限制:65535 KB 难度:1   描述 输入n(n<100)个数,找出其中最小的数,将它与最前面的数交换后输出这些数.(如果这个第一个数就是最 ...

  5. Js C# 实现跨域访问数据

    使用项目一的js调用项目二的数据 1.项目一 @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta ...

  6. Hightcharts动态创建series

    第一种方法: 申明options时动态设置series,然后再创建chart对象 代码如下: <html> <head> <title>Highcharts Exa ...

  7. Spring MVC过滤器-字符集过滤器(CharacterEncodingFilter)

    spring的字符集过滤通过用于处理项目中的乱码问题,该过滤器位于org.springframework.web.filter包中,指向类CharacterEncodingFilter,Charact ...

  8. JAVA生成带Logo的二维码

    1.下载生成二维码所需要的jar包qrcode.jar: 2.直接上生成二维码的java代码 //需要导入的包 import java.awt.Color;import java.awt.Graphi ...

  9. Android:The connection to adb is down, and a severe error has occured.解决方法一

    在自己机上打安桌虚拟机,竟然提示“The connection to adb is down, and a severe error has occured.please ensure ......” ...

  10. odoo报表条码无法显示解决[转]

    当服务器为Linux(Ubuntu)时,ODOO打印的报表上是有条码的,却显示空白框框.问题在于服务器上没有安装条码的字体,reportlab渲染条码图形失败,导致显示不正常. 将附件中的字体下载,解 ...