Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 2149:c476db6cf3eb
Seems to be some trouble with the function-pointer-based version of the connection here - recent-files menu isn't working on old systems with backward-compatible build - replace with an alternative mechanism again
author | Chris Cannam |
---|---|
date | Wed, 05 Dec 2018 11:35:20 +0000 |
parents | 6e3ef3aa341e |
children | b96492b41c74 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Wed Dec 05 11:34:35 2018 +0000 +++ b/main/MainWindow.cpp Wed Dec 05 11:35:20 2018 +0000 @@ -1943,11 +1943,10 @@ m_recentFilesMenu->clear(); vector<QString> files = m_recentFiles.getRecent(); for (size_t i = 0; i < files.size(); ++i) { - /* F. Nicol patch 13 Aug. 2016 */ - const QString& path = files[i]; + QString path = files[i]; QAction *action = new QAction(path, this); - connect(action, &QAction::triggered, [this, path] { openRecentFile(path);}); - /* end of patch */ + action->setObjectName(path); + connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile())); if (i == 0) { action->setShortcut(tr("Ctrl+R")); m_keyReference->registerShortcut @@ -3397,24 +3396,24 @@ } void -MainWindow::openRecentFile(const QString& path) +MainWindow::openRecentFile() { - /* F. Nicol patch 13 Aug. 2016 */ -#if 0 QObject *obj = sender(); QAction *action = dynamic_cast<QAction *>(obj); if (!action) { cerr << "WARNING: MainWindow::openRecentFile: sender is not an action" - << endl; + << endl; return; } - QString path = action->text(); -#endif - /* End of F. Nicol patch 13 Aug. 2016 */ - - if (path == "") return; + QString path = action->objectName(); + + if (path == "") { + cerr << "WARNING: MainWindow::openRecentFile: action incorrectly named" + << endl; + return; + } FileOpenStatus status = openPath(path, ReplaceSession);