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程序 ...
随机推荐
- @PostConstruct和@PreConstruct注解
@PostConstruct和@PreConstruct.这两个注解被用来修饰一个非静态的void()方法.而且这个方法不能有抛出异常声明. @PostConstruct //方式1 public v ...
- mongodb与python随手记
在python中使用pymongo连接mongodb数据库. 基本代码如下: from pymongo import MongoClient client = MongoClient('127.0.0 ...
- ribbon 收起 最小化 导航条 选项卡 navBarControl 隐藏
//设置隐藏导航条 this.ribbonControl.Minimized = true; 正解 //设置navBarControl隐藏 navBarControl.OptionsNavPane.N ...
- C++ 流控制函数setw()、setfill()、setbase()、setprecision()的使用
头文件: #include <iostream> #include <iomanip> 功能: std::setw :需要填充多少个字符,默认填充的字符为' '空格 std:: ...
- 解决js array的key不为数字时获取长度的问题
最近写js时碰到了当数组key不为数字时,获取数组的长度为0 的情况. 1.问题场景 var arr = new Array(); arr[‘s1‘] = 1001; console.log(arr. ...
- 关于sql通配符检索问题-【.NET】
确定给定的字符串是否与指定的模式匹配.模式可以包含常规字符和通配符字符.模式匹配过程中,常规字符必须与字符串中指定的字符完全匹配.然而,可使用字符串的任意片段匹配通配符.与使用 = 和 != 字符串比 ...
- lua热重载
热重载,就是不重新开unity让代码的变化直接看出来,一般在开发时候使用 lua中通过require导入的文件,最终都存在package.loaded这个table中.require会判断是否文件已经 ...
- EntityManager对象管理
根据EntityManager对象的管理方式,可以有以下两种类型: — 容器托管的(container-managed)EntityManager对象 容器托管的EntityManager对象最简单, ...
- Hibernate各种查询操作(一)
测试数据库如下 t_sort表: t_good表: 一.对象导航方式查询 查询所有食品类下面的食品 代码: //对象导航查询 @Te ...
- java POST 传值 加签 验证
话不多说,代码如下 package com.syl.test_key; import lombok.extern.slf4j.Slf4j; import org.apache.commons.code ...