最近用到了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. 【wikioi】1269 匈牙利游戏(次短路+spfa)

    http://www.wikioi.com/problem/1269/ 噗,想不到.. 次短路就是在松弛的时候做下手脚. 设d1为最短路,d2为次短路 有 d1[v]>d1[u]+w(u, v) ...

  2. vim molokai配色方案(调过)

    " Vim color file " " Author: Tomas Restrepo <tomas@winterdom.com> " " ...

  3. httpclient爬取性感美图

    依赖httpclient4.2,Jsop SemeiziCrawler.java package kidbei.learn.crawler; import java.io.File; import j ...

  4. Configuration of OpenCV2.1.0 with VS2010

    Add in the system Path: C:\Program Files (x86)\OpenCV-2.1.0\build\bin\Debug Project->Project Prop ...

  5. swift -- 学习记录

    先把疯狂的swift这本书大致看了一遍 2016.7.13 因为实在是太闲,所以决定把公司的应用用swift写一遍 然后顺便看看swift的官方文档 这里有一个官文的中文翻译,感动啊 http://w ...

  6. 连接sql server的语句

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  7. Web服务器上可能被包含或被请求的不同脚本源代码文件

    Web服务器上可能被包含或被请求的不同脚本源代码文件的大致数量(建议值为1024~4096). ; 如果你不能确定,则设为 0 :此设定主要用于拥有数千个源文件的站点. apc.optimizatio ...

  8. Java量与变量的区别

    常量:其值不变即为常量. 语法: 数据类型 常量名 = 值; double PI = 3.14; 备注: 一般默认常量名大写. 变量与常量之间关系(量间关系) 先来一个简单的实例,好了解 Java 里 ...

  9. Angualar:指令大全

    指令: 内置渲染指令 内置事件指令 内置节点指令 自定义指令 restrict template replace属性 templateUrl属性 trnsclude priorty terminal属 ...

  10. linux redis迁移

    在原服务器上的redis执行save命令后,生成了dump文件,拷贝到新服务器的安装目录,可能是版本问题,数据无法还原. 针对这个问题, 1.在配置文件中加入: slave of 原服务器的ip和端口 ...