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,"关于","这是本公司版权软件,盗版必究!");
    }
  • 相关阅读:
    进程与线程
    java的引用
    基本类型变量、引用类型变量的在java中的存放位置
    Spring学习(三)
    Spring学习(一)
    Struts2学习(三)
    Vue,resource基本使用
    uni-app v-for数据的绑定唯一
    uni-app,v-for时 block 和 view 的使用
    Vue,生命周期函数演示(创建阶段的4个钩子函数,组件运行和销毁阶段的钩子函数)
  • 原文地址:https://www.cnblogs.com/zhanggaofeng/p/5987934.html
Copyright © 2011-2022 走看看