I want to add some QAction
dynamically from settings file :
_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();
which fails to compile due to this line connect(action, SIGNAL(triggered()), this, openFile(action->objectName()));
Question :
How do I connect a QAction to a given function (with parameters)?