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();
}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的QAction添加事件响应的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: android 反编译全套工具
- 下一篇: 树莓派Raspbian Buster/D
