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程序 ...
随机推荐
- [短期持续更新]Codeforces 构造题一览
说实话我觉得做这种题很没意思(不够硬核), 可是人有短板终究是要补的...起码这种类型补起来相对简单 所以还是把先前准备好的专题放下吧,做点实现上比较休闲的题 ps.为了精简篇幅,代码全部丢到ubun ...
- 主库binlog被purge的情形
1.演示实验环境 --主库版本: root@(none)>show variables like 'version'; +---------------+-------------------- ...
- 安装 VMware Tools
参考帮助文档 错误#1: tar: vmware-tools-distrib: Cannot mkdir: Read-only file system 解决方法: mkdir /mnt/cdrom m ...
- C# DataTable 用法
1.创建DataTable DataTable dataTable = new DataTable(); //创建一个空表 2.创建DataRow DataRow row = dataTable.Ne ...
- HTML5获取地理经纬度并通过百度接口得到实时位置
注:用的时候将获取北京位置那放到获取经度纬度后面即可 -----------实际用的时候的代码如下:start -------- var myCity;getLocation()function g ...
- vue中遇到的坑keep-alive、vue-router相关
在进入详情页之后,然后返回到首页,报错如下. 虽说是报错了,但是对我最后的页面并没有什么影响,但是出现了一堆红色的报错,作为一个前端工程师,看着还是十分难受的!! 一旦出现问题,我的解决思路一般是, ...
- Oracle 数据库、表、方案的逻辑备份与恢复
数据库(表)的逻辑备份与恢复 逻辑备份是指使用工具export将数据对象的结构和数据导出到文件的过程,逻辑恢复是指当数据库对象被破坏而使用工具import利用备份的文件把数据对象导入到数据库的过程,逻 ...
- 【CSS】 布局之剖析负边距
我们都知道,一个元素框的大小是由元素内容+内边距+边框+外边距来决定的. 关于内边距padding,内边距呈现了元素的背景,其设置值是不可以为负的. 而对于外边距margin,默认为透明,设置值可以为 ...
- Log4J 配置文件模板及代码说明
相对而言,这个日志系统的配置就没那么随意了,而且有些功能用起来也不是那么爽,譬如动态读取配置文件.不过鉴于使用这个日志的系统还是很多,所以也写一个demo贴出来,风格跟log4j2一样,配置的说明全在 ...
- [转]OLAP的12条准则
OLAP的12条准则 Multidimensional conceptual view OLAP模型必须提供多维概念视图 User-analysts would view an enterprise ...