From 7009ec0c003bd497adf91c14cf4fbeb32af35314 Mon Sep 17 00:00:00 2001 From: sonata-chen Date: Thu, 5 Sep 2024 22:05:42 +0800 Subject: [PATCH] scide: fix failing to open recent files if KDE's AutoCheckAccelerators is enabled --- editors/sc-ide/widgets/main_window.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/editors/sc-ide/widgets/main_window.cpp b/editors/sc-ide/widgets/main_window.cpp index 1cbb920443c..d1d0b662e94 100644 --- a/editors/sc-ide/widgets/main_window.cpp +++ b/editors/sc-ide/widgets/main_window.cpp @@ -849,8 +849,10 @@ void MainWindow::updateRecentDocsMenu() { const QStringList& recent = mMain->documentManager()->recents(); - foreach (const QString& path, recent) - mRecentDocsMenu->addAction(path); + foreach (const QString& path, recent) { + QAction* action = mRecentDocsMenu->addAction(path); + action->setData(QVariant(path)); + } if (!recent.isEmpty()) { mRecentDocsMenu->addSeparator(); @@ -858,7 +860,9 @@ void MainWindow::updateRecentDocsMenu() { } } -void MainWindow::onOpenRecentDocument(QAction* action) { mMain->documentManager()->open(action->text()); } +void MainWindow::onOpenRecentDocument(QAction* action) { + mMain->documentManager()->open(action->data().value()); +} void MainWindow::onInterpreterStateChanged(QProcess::ProcessState state) { switch (state) {