Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 1253:cc434d37a126 3.0-integration
Patch from Fab Nicol to fix a problem with Recent Files menu:
"Patch corrects a linux version bug already there in recent tags (at least 2.5, including in official Linux distros) and apparently remaining unnotices wrt open Recent Files submenu: an offending ampersand in paths (perhaps a Qt bug) makes the menu useless."
author | Chris Cannam |
---|---|
date | Mon, 15 Aug 2016 16:45:17 +0100 |
parents | 2ebb6b52388a |
children | 65b8c009a9f2 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Mon Aug 15 16:42:19 2016 +0100 +++ b/main/MainWindow.cpp Mon Aug 15 16:45:17 2016 +0100 @@ -1764,8 +1764,11 @@ m_recentFilesMenu->clear(); vector<QString> files = m_recentFiles.getRecent(); for (size_t i = 0; i < files.size(); ++i) { - QAction *action = new QAction(files[i], this); - connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile())); + /* F. Nicol patch 13 Aug. 2016 */ + const QString& path = files[i]; + QAction *action = new QAction(path, this); + connect(action, &QAction::triggered, [this, path] { openRecentFile(path);}); + /* end of patch */ if (i == 0) { action->setShortcut(tr("Ctrl+R")); m_keyReference->registerShortcut @@ -3073,8 +3076,10 @@ } void -MainWindow::openRecentFile() +MainWindow::openRecentFile(const QString& path) { + /* F. Nicol patch 13 Aug. 2016 */ +#if 0 QObject *obj = sender(); QAction *action = dynamic_cast<QAction *>(obj); @@ -3085,6 +3090,9 @@ } QString path = action->text(); +#endif + /* End of F. Nicol patch 13 Aug. 2016 */ + if (path == "") return; FileOpenStatus status = openPath(path, ReplaceSession);