zoukankan      html  css  js  c++  java
  • QT 对话框二

    QMessageBox类
    information()函数,主要是提示功能,不需要用户选择
    StandardButton QMessageBox::information
    (
        QWidget *parent,//消息框父窗口指针
        const QString & title,//消息框标题栏
        const QString & text,消息框文字提示信息
        StandardButtons buttons=Ok,
        StandardButton defaultButton=No
    )
    void Widget::btn_click()
    {
        /*一般不适用后两个参数*/
        QMessageBox::information(this,"提示信息","提示内容");
    }
    QMessageBox类
    warning()函数:
    warning消息框使用QMessageBox::warning()函数完成,函数形式如下
    StandardButton QMessageBox::warning
    (
        QWidget *parent,//消息框父窗口指针
        const QString & title,//消息框标题栏
        const QString & text,消息框文字提示信息
        StandardButtons buttons=Ok,
        StandardButton defaultButton=No
    )
    void Widget::btn_click()
    {
        /*和information()函数类似,只是页面上多了一个警告标志*/
        if(QMessageBox::warning(this,"警告","你修改的内容还未保存,是否要保存队该文件的修改!",QMessageBox::Save|QMessageBox::Discard|QMessageBox::Cancel,QMessageBox::Save)==QMessageBox::Save)
        {
            setWindowTitle("save");
        }
    }
    QMessageBox类
    critical()函数--严重错误:
    critical消息框使用QMessageBox::critical()函数完成,函数形式如下
    StandardButton QMessageBox::critical
    (
        QWidget *parent,//消息框父窗口指针
        const QString & title,//消息框标题栏
        const QString & text,消息框文字提示信息
        StandardButtons buttons=Ok,
        StandardButton defaultButton=No
    )
    void Widget::btn_click()
    {
        QMessageBox::critical(this,"严重错误","该文件不可以删除!");
    }
    QMessageBox类
    about()函数:
    about消息框使用QMessageBox::about()函数完成,函数形式如下
    void QMessageBox::about
    (
        QWidget *parent,//消息框父窗口指针
        const QString & title,//消息框标题栏
        const QString & text,消息框文字提示信息
    )
    void Widget::btn_click()
    {
        QMessageBox::about(this,"关于","这是本公司版权软件,盗版必究!");
    }
  • 相关阅读:
    OSG嵌入QT(QT界面使用Qt Designer编辑)
    C++ Makefile文件编写
    cbp2make使用
    for循环之后的return
    C++引用形参,函数返回多个值
    个人感悟之代理模式
    个人感悟之单例模式
    个人感悟之简单工厂模式-工厂方法模式-抽象工厂模式
    Java设计模式
    (转)java之Spring(IOC)注解装配Bean详解
  • 原文地址:https://www.cnblogs.com/zhanggaofeng/p/5987934.html
Copyright © 2011-2022 走看看