From 158bb5081678931921154e20d2f9e3a0ecedfb32 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Tue, 17 Jan 2023 21:56:31 +0900 Subject: [PATCH] Fix recent files menu on old KDE in a different way (#6612) --- src/gui/MainApplication.cpp | 13 +++++++++++++ src/gui/MainWindow.cpp | 20 -------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/gui/MainApplication.cpp b/src/gui/MainApplication.cpp index ab45ce304b6..d33ede4d260 100644 --- a/src/gui/MainApplication.cpp +++ b/src/gui/MainApplication.cpp @@ -39,6 +39,19 @@ MainApplication::MainApplication(int& argc, char** argv) : QApplication(argc, argv), m_queuedFile() { +#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) + // Work around a bug of KXmlGui < 5.55 + // which breaks the recent files menu + // https://bugs.kde.org/show_bug.cgi?id=337491 + for (auto child : children()) + { + if (child->inherits("KCheckAcceleratorsInitializer")) + { + delete child; + } + } +#endif + #if defined(LMMS_BUILD_WIN32) installNativeEventFilter(this); #endif diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 706d63e27c9..b53ce629eac 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "AboutDialog.h" @@ -78,22 +77,6 @@ namespace lmms::gui { -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) -//Work around an issue on KDE5 as per https://bugs.kde.org/show_bug.cgi?id=337491#c21 -void disableAutoKeyAccelerators(QWidget* mainWindow) -{ - using DisablerFunc = void(*)(QWidget*); - QLibrary kf5WidgetsAddon("KF5WidgetsAddons", 5); - auto setNoAccelerators - = reinterpret_cast(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget")); - if(setNoAccelerators) - { - setNoAccelerators(mainWindow); - } - kf5WidgetsAddon.unload(); -} -#endif - MainWindow::MainWindow() : m_workspace( nullptr ), @@ -103,9 +86,6 @@ MainWindow::MainWindow() : m_metronomeToggle( 0 ), m_session( Normal ) { -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) - disableAutoKeyAccelerators(this); -#endif setAttribute( Qt::WA_DeleteOnClose ); auto main_widget = new QWidget(this);