From d9e6c30567c58507dc1b6f9eb2edbe67a0acc624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 3 Mar 2024 23:11:48 +0100 Subject: [PATCH] Use the QAction data() for file paths rather than text() As seen in KDE Neon, some Qt themes or distros mangle the text() by adding automatic shortcut accelerators that break the paths for opening. --- src/GUI/gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index cc29a238..facf0286 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -2092,8 +2092,9 @@ void GUI::updateRecentFiles(const QString &fileName) actions = _recentFilesActionGroup->actions(); QAction *before = actions.size() ? actions.last() : _recentFilesEnd; - _recentFilesMenu->insertAction(before, - new QAction(fileName, _recentFilesActionGroup)); + a = new QAction(fileName, _recentFilesActionGroup); + a->setData(fileName); + _recentFilesMenu->insertAction(before, a); _recentFilesMenu->setEnabled(true); } @@ -2110,7 +2111,7 @@ void GUI::clearRecentFiles() void GUI::recentFileSelected(QAction *action) { int showError = 1; - openFile(action->text(), true, showError); + openFile(action->data().toString(), true, showError); } #endif // Q_OS_ANDROID @@ -3229,6 +3230,7 @@ void GUI::loadRecentFiles(const QStringList &files) for (int i = 0; i < files.size(); i++) { QAction *a = new QAction(files.at(i), _recentFilesActionGroup); + a->setData(files.at(i)); _recentFilesMenu->insertAction(before, a); before = a; }