为菜单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();
}