我想QAction
从设置文件中动态添加一些:
_settings.beginGroup("openRecent");
QStringList recentList = _settings.childKeys();
foreach(QString recentFile, recentList)
{
QAction * action = new QAction(_settings.value(recentFile, "empty").toString(), this);
action->setObjectName(_settings.value(recentFile, "empty").toString());
connect(action, SIGNAL(triggered()), this, openFile(action->objectName()));
_recentFileButtons.append(action);
}
_settings.endGroup();
由于这一行而无法编译connect(action, SIGNAL(triggered()), this, openFile(action->objectName()));
问题 :
如何将 QAction 连接到给定函数(带参数)?