QMessageBox 用法
案例一:
QMessageBox msgBox;
msgBox.setText("The document has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();
switch (ret)
{
case QMessageBox::Save:
// Save was clicked
break;
case QMessageBox::Discard:
// Don't Save was clicked
break;
case QMessageBox::Cancel:
// Cancel was clicked
break;
default:
// should never be reached
break;
}
案例二:
int ret = QMessageBox::warning(this,
tr("My Application"),
tr("The document has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
QMessageBox::Save);
案例三:添加按钮、判断哪个按钮按下
QMessageBox msgBox;
QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole);
QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);
if(msgBox.clickedButton() == connectButton)
{
// connect
}
else if(msgBox.clickedButton() == abortButton)
{
// abort
}
msgBox.exec();
http://blog.csdn.net/jan5_reyn/article/details/38955705
QMessageBox 用法的更多相关文章
- qt5信息提示框QMessageBox用法
information QMessageBox::information(NULL, "Title", "Content", QMessageBox::Yes ...
- qt5信息提示框QMessageBox用法(很全)
information QMessageBox::information(NULL, "Title", "Content", QMessageBox::Yes ...
- QMessageBox的用法
QMessageBox的用法 先来看一下最熟悉的QMessageBox::information.我们在以前的代码中这样使用过: QMessageBox::information(NULL, ...
- QMessageBox 的四种用法
void MainWindow::on_info_clicked() { //info QMessageBox::information(this, "Title", " ...
- paip.c++ qt messagebox用法
paip.c++ qt messagebox用法 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net ...
- 六、pyqt5对话框——QInputDialog、QColorDialog、QFontDialog、QMessageBox、QFileDialog
目录: 一.对话框综合示例 二.QDialog 三.QInputDialog 四.QMessageDialog 五.QFileDialog pyqt5的对话框有多种类型,比如输入对话框(QInput ...
- Qt 信息提示框 QMessageBox
information QMessageBox::information(NULL, "Title","Content",QMessageBox::Yes | ...
- EditText 基本用法
title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...
- jquery插件的用法之cookie 插件
一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...
随机推荐
- 打造自己博客(wordpress)的wap手机版本
这儿介绍我试用的两款插件:wordpress-mobile-edition和wp-t-wap.1.先说一下两者的区别. wordpress-mobile-edition插件使用后,可以用手机直接访问你 ...
- Ubuntu下lamp(PHP+Mysql+Apache)搭建+完全卸载卸载方法
安装apache2 sudo apt-get install apache2 安装完成,运行如下命令重启下: sudo /etc/init.d/apache2 restart 在浏览器里输入http: ...
- UVA-514 Rails (栈)
Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The s ...
- linux多线程示例
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h& ...
- Android应用开发提高篇(1)-----获取本地IP
链接地址:http://www.cnblogs.com/lknlfy/archive/2012/02/21/2361802.html 一.概述 习惯了Linux下的网络编程,在还没用智能机之前就一直想 ...
- 51NOD 算法马拉松8
题目戳这里:51NOD算法马拉松8 某天晚上kpm在玩OSU!之余让我看一下B题...然后我就被坑进了51Nod... A.还是01串 水题..怎么乱写应该都可以.记个前缀和然后枚举就行了.时间复杂度 ...
- BZOJ 3916: [Baltic2014]friends( hash )
字符串哈希..然后枚举每一位+各种判断就行了 ----------------------------------------------------------------------------- ...
- quartz 定时调度持久化数据库配置文件
1 下载quartz对应版本jar包 2 初始化对应数据库sql(版本需要对应,不然会出现少字段的情况) ,下载地址 https://github.com/quartz-scheduler/quar ...
- 国内BI工具/报表工具厂商简介
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...
- 帝国cms数据表详细说明
表 名 解释 phome_ecms_infoclass_news 新闻采集规则记录表 phome_ecms_infotmp_news 采集临时表 phome_ecms_news 新闻主数据记录表 ph ...