The problem is that you create the same connection tree times in the loop. What you probably need, is just doing it only once:
[..]
foreach (QString fileName, fileNameList) {
QAction *loadFile = new QAction(fileName, this);
load->addAction(loadFile);
}
connect(load, SIGNAL(triggered(QAction *)), this, SLOT(load(QAction *)));
UPDATE
The alternative solution would be:
foreach (QString fileName, fileNameList) {
QAction *loadFile = new QAction(fileName, this);
load->addAction(loadFile);
connect(loadFile, SIGNAL(triggered()), this, SLOT(load()));
}
with the corresponding slot:
void MainWindow::load() {
QAction *action = qobject_cast<QAction *>(sender());
if (action)
qDebug() << action->text();
}