zoukankan      html  css  js  c++  java
  • QAction添加事件响应

    为菜单Help下的About添加响应

    about对应actionAbout

    点击QAction会发出triggered()信号,所以,我们要做的是声明一个slot,然后connect这个信号。

    头文件中

    public slots:

        void showAboutMsg();

     

    构造函数中

    connect(actionAbout,SIGNAL(triggered()),this,SLOT(showAboutMsg()));

    实现:

    void ExcelReport::showAboutMsg()

    {

        QMessageBox msgBox(this);

        msgBox.setWindowTitle("About");

        msgBox.setTextFormat(Qt::RichText);   //this is what makes the links clickable

        msgBox.setText("QQ:895377235<br>Email:<a href='mailto:hnrayer@gmail.com'>hnrayer@gmail.com</a><br>WebSite:<a href=http://www.cnblogs.com/elesos/ >elesos</a>");

        msgBox.setIconPixmap(QPixmap(":/ico/res/ExcelReport.ico"));

        msgBox.exec();

    }

  • 相关阅读:
    MySQL
    php抽象类和接口
    php面向对象三大特征
    php面向对象
    Git
    css3属性
    数据渲染
    ajax(2)
    ajax笔记
    作用域面试题
  • 原文地址:https://www.cnblogs.com/elesos/p/2836990.html
Copyright © 2011-2022 走看看