最近用到了QMessgaeBox和QInputDialog,QMessageBox用于提示,警告等消息,QInputDialog给用户弹出输入对话框。

参考链接

http://chenboqiang.blog.51cto.com/1068057/321900

http://blog.csdn.net/xgbing/article/details/7828212

http://devbean.blog.51cto.com/448512/219338/

QMessageBox

  QMessageBox::StandardButton reply;
reply = QMessageBox::warning(NULL, // parent
"warning", // title
"Are you sure to erase the EMMC?", // text
QMessageBox::Yes|QMessageBox::No, // 有几个选项,这里有YES,和NO
QMessageBox::No); // 默认选项是NO
if (reply == QMessageBox::Yes) //选项的判断
{
...
...
}
else if (reply == QMessageBox::No)
{
...
...
}

QInputDialog

    QString text = QInputDialog::getText(NULL, "Password",
"Please input password",
// QLineEdit::Password, //输入的是密码,不显示明文
QLineEdit::Normal, //输入框明文
NULL,
&isOK); if(isOK) {
QMessageBox::information(NULL, "Information",
"Your comment is: <b>" + text + "</b>",
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
}

Tony Liu

2016-11-14, Shenzhen

qt QMessageBox QInputDialog的更多相关文章

  1. qt QMessageBox 中文乱码的问题

    QMessageBox::information(this,"Warn", "请插入U盘"); ==================> QMessageB ...

  2. C/C++ Qt Dialog 对话框组件应用

    在Qt中对话框分为两种形式,一种是标准对话框,另一种则是自定义对话框,在一般开发过程中标准对话框使用是最多的了,标准对话框一般包括 QMessageBox,QInputDialog,QFileDial ...

  3. QT+ 使用标准对话框+关于对话框+问题对话框+文件对话框

    #include "mainwindow.h" #include <QMenuBar> #include <QMenu> #include <QAct ...

  4. python pyqt

    一.控件 1.单行文本框QLineText clear() 清除文本框中的内容contextMenuEvent() 右键菜单事件copy() 复制文本框中的内容cut() 剪切文本框中的内容paste ...

  5. 2.窗口部件-对话框QDialog

    1.模态和非模态 看代码 widget.cpp #include "widget.h" #include "ui_widget.h" #include<Q ...

  6. [ PyQt入门教程 ] PyQt5基本控件使用:消息弹出、用户输入、文件对话框

    本文主要介绍PyQt界面实现中常用的消息弹出对话框.提供用户输入的输入框.打开文件获取文件/目录路径的文件对话框.学习这三种控件前,先想一下它们使用的主要场景: 1.消息弹出对话框.程序遇到问题需要退 ...

  7. 六、pyqt5对话框——QInputDialog、QColorDialog、QFontDialog、QMessageBox、QFileDialog

    目录:  一.对话框综合示例 二.QDialog 三.QInputDialog 四.QMessageDialog 五.QFileDialog pyqt5的对话框有多种类型,比如输入对话框(QInput ...

  8. Qt 学习之路 2(15):标准对话框 QMessageBox

    Qt 学习之路 2(15):标准对话框 QMessageBox  豆子  2012年9月18日  Qt 学习之路 2  40条评论 所谓标准对话框,是 Qt 内置的一系列对话框,用于简化开发.事实上, ...

  9. Qt学习笔记 QMessageBox

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

随机推荐

  1. [Cocos2d-x For WP8]Menu菜单

    菜单栏这是游戏里面基本的控件来的, 头文件: #include <CCMenu.h>                        继承关系图:   头文件:  #include < ...

  2. Get the image file(s) some informations,Including the Make,Model,Date/Time,etc

    This is a blog about how to get the image file(s) some informations.Including the Make,Model,Date/Ti ...

  3. fetch API

    一.什么是fetch? fetch的作用类似于XMLHttpRequet的作用,用于异步请求网络,其提供的API更加的完善. fetch提供了Request和Response对象的定义,用于自定义网络 ...

  4. Qt5 和 Qt4 的一些改动和不同

    Qt5从Qt4升级后,很多原来Qt4中定义的函数或者变量由于种种原因在Qt5中被遗弃,所以用Qt5来编译Qt4的一些工程项目时,难以避免的会需要修改一些地方,下面就罗列一些我遇到的一些需要修改的地方: ...

  5. 多个mysql增加多个服务

    //mysql安装目录 mysqld --install mysqld --remove mysql5.5 mysqld --remove mysql5.5 C:\Program Files\MySQ ...

  6. 3. Configure the Identity Service

    Controller Node: 安装认证服务: 1. sudo apt-get install keystone   2. sudo vi /etc/keystone/keystone.conf [ ...

  7. 1. Nginx

    参考: http://www.darrenfang.com/2014/02/install-php-with-nginx-on-ubuntu/   安装: apt-get install python ...

  8. SCU 2941 I NEED A OFFER!(01背包变形)

    I NEED A OFFER!     64bit IO Format: %lld & %llu Submit Status Description Description Speakless ...

  9. Nginx模块fastcgi_cache的几个注意点

    fastcgi响应http请求的结果中,响应头包括Expires、Cache-Control、Set-Cookie三个,都会可能不被cache. thinkphp3.0禁止session自动启动 co ...

  10. 控制变量法-初中物理-Nobel Lecture, December 12, 1929-php执行SET GLOBAL connect_timeout=2效果

    $link = mysqli_connect("localhost", "wu", "wp", "wdb"); $sql ...