qt MessageBOX 消息
void MessageBox::slotQuestion()
{
switch(QMessageBox::question(this,"Question",tr("It's end of document,search from begin?"),
QMessageBox::Ok|QMessageBox::Cancel,QMessageBox::Ok))
{
case QMessageBox::Ok:
label->setText(" Question button / Ok ");
break;
case QMessageBox::Cancel:
label->setText(" Question button / Cancel ");
break;
default:
break;
}
return;
} void MessageBox::slotInformation()
{
QMessageBox::information(this,"Information",tr("anything you want tell user"));
return;
} void MessageBox::slotWarning()
{
switch(QMessageBox::warning(this,"Warning",tr("Save changes to document?"),
QMessageBox::Save|QMessageBox::Discard|QMessageBox::Cancel,QMessageBox::Save))
{
case QMessageBox::Save:
label->setText(" Warning button / Save ");
break;
case QMessageBox::Discard:
label->setText(" Warning button / Discard ");
break;
case QMessageBox::Cancel:
label->setText(" Warning button / Cancel ");
break;
default:
break;
}
return; } void MessageBox::slotCritical()
{
QMessageBox::critical(this,"Critical",tr("tell user a critical error"));
label->setText(" Critical MessageBox ");
return;
} void MessageBox::slotAbout()
{
QMessageBox::about(this,"About",tr("Message box example!"));
label->setText(" About MessageBox ");
return;
} void MessageBox::slotAboutQt()
{
QMessageBox::aboutQt(this,"About Qt");
label->setText(" About Qt MessageBox ");
return;
} void MessageBox::slotCustom()
{
QMessageBox customMsgBox;
customMsgBox.setWindowTitle("Custom message box");
QPushButton *lockButton = customMsgBox.addButton(tr("Lock"),QMessageBox::ActionRole);
QPushButton *unlockButton = customMsgBox.addButton(tr("Unlock"),QMessageBox::ActionRole);
QPushButton *cancelButton = customMsgBox.addButton(QMessageBox::Cancel);
customMsgBox.setIconPixmap(QPixmap(":/images/linuxredhat.png"));
customMsgBox.setText(tr("This is a custom message box"));
customMsgBox.exec(); if(customMsgBox.clickedButton() == lockButton)
label->setText(" Custom MessageBox / Lock ");
if(customMsgBox.clickedButton() == unlockButton)
label->setText(" Custom MessageBox / Unlock ");
if(customMsgBox.clickedButton() == cancelButton)
label->setText(" Custom MessageBox / Cancel "); return;
}
main.cpp
#include "messagebox.h"
#include <QtGui/QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MessageBox *w=new MessageBox;
w->show();
return a.exec();
}
效果图:






qt MessageBOX 消息的更多相关文章
- paip.c++ qt messagebox用法
paip.c++ qt messagebox用法 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net ...
- C# MessageBox 消息对话框
在程序中,我们经常使用消息对话框给用户一定的信息提示,如在操作过程中遇到错误或程序异常,经常会使用这种方式给用于以提示.在C#中,MessageBox消息对话框位于System.Windows.For ...
- C#中的MessageBox消息对话框
关键字:C# MessageBox 消息对话框 在程序中,我们经常使用消息对话框给用户一定的信息提示,如在操作过程中遇到错误或程序异常,经常会使用这种方式给用于以提示.在C#中,MessageBox消 ...
- WPF 实现带蒙版的 MessageBox 消息提示框
WPF 实现带蒙版的 MessageBox 消息提示框 WPF 实现带蒙版的 MessageBox 消息提示框 作者:WPFDevelopersOrg 原文链接: https://github.com ...
- Ext.MessageBox消息框
Ext JS消息提示框主要包括:alert.confirm.prompt.show 1.Ext.MessageBox.alert() 调用格式: alert( String title, String ...
- [转载]ExtJs4 笔记(6) Ext.MessageBox 消息对话框
作者:李盼(Lipan) 出处:[Lipan] (http://www.cnblogs.com/lipan/)版权声明:本文的版权归作者与博客园共有.转载时须注明本文的详细链接,否则作者将保留追究其法 ...
- ExtJs4 笔记(6) Ext.MessageBox 消息对话框
本篇演示消息对话框的用法,ExtJs封装了可能用到的各类消息框,并支持自定义的配置. 如下是用到的html: [html] <h1>各种消息框</h1> <div id= ...
- windows程序设计 MessageBox消息框
MessageBox函数 int WINAPI MessageBoxW( HWND hWnd,//窗口句柄 LPCWSTR lpText,//消息框主体显示的字符串 LPCWSTR lpCaption ...
- 【转】QT CEF3 消息循环处理
初次写博客,可能有点乱, 按照自己的实际经历谈一下CEF3钟遇到的一些坑,希望对以后的小伙有些帮助. 先说一下经历,当初第一次接触CEF3的时候,没做特殊处理,直接将cef3封装成控件,嵌入到QT程序 ...
随机推荐
- 通过shell处理多行数据
### 源文件 cat > tmpb <<'EOF' dbname:db_a,start_time::: query_end_time:::,query_total_time:,da ...
- SpringCloud---分布式配置中心---Spring Cloud Config
1.概述 1.1 Spring Cloud Config是Spring Cloud的一个全新项目: 作用:为分布式系统中的基础设施.微服务应用提供集中化的外部配置支持: 分为服务端.客户端2个 ...
- 数据备份及恢复(mongodump/mongorestore)
说明 1.mongodump创建高保真的BSON文件,mongorestore可以用其恢复数据库.对于小型数据库的备份和恢复,这两个工具非常简单和高效,但对于大型数据库的备份并不理想.2.mongod ...
- Oracle 数据库、表、方案的逻辑备份与恢复
数据库(表)的逻辑备份与恢复 逻辑备份是指使用工具export将数据对象的结构和数据导出到文件的过程,逻辑恢复是指当数据库对象被破坏而使用工具import利用备份的文件把数据对象导入到数据库的过程,逻 ...
- SpagoBI系列----------[01]SpagoBI简介及安装步骤
商务智能套件SpagoBI提供一个基于J2EE的框架用于管理BI对象如报表.OLAP分析.仪表盘.记分卡以及数据挖掘模型等的开源BI产品.它提供的BI管理器能 够控制.校验.验证与分发这些BI对象. ...
- mysql 导入 excel 数据
客户准备了一些数据存放在 excel 中, 让我们导入到 mysql 中.先上来我自己把数据拷贝到了 txt 文件中, 自己解析 txt 文件,用 JDBC 循环插入到数据库中. 后来发现有更简单 ...
- 在Eclipse或工作空间中 ,复制或修改项目后,把项目部署后发现还是原来的项目名称
1 问题引出 1 在eclipse中直接复制一个项目,修改名称之后,然后部署,部署之后的项目名称还有原来的项目名称 2 在eclipse的工作空间中直接复制一个项目,修改名字之后,发布也会出现同样的问 ...
- HttpUtils 封装类
作为一个web开发人员,对Http 请求,并不陌生.有时候,我们请求的时候,需要使用代码实现,一般情况,我们使用Apache Jakarta Common 下的子项目.的HttpClient. 可是我 ...
- 关于sql通配符检索问题-【.NET】
确定给定的字符串是否与指定的模式匹配.模式可以包含常规字符和通配符字符.模式匹配过程中,常规字符必须与字符串中指定的字符完全匹配.然而,可使用字符串的任意片段匹配通配符.与使用 = 和 != 字符串比 ...
- poj 2405 Beavergnaw
Beavergnaw Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6310 Accepted: 4158 Descri ...