Skip to content

Commit

Permalink
Fix recent files menu on old KDE in a different way (#6612)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong authored Jan 17, 2023
1 parent e8e54a7 commit 158bb50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
13 changes: 13 additions & 0 deletions src/gui/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QShortcut>
#include <QLibrary>
#include <QSplitter>

#include "AboutDialog.h"
Expand Down Expand Up @@ -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<DisablerFunc>(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget"));
if(setNoAccelerators)
{
setNoAccelerators(mainWindow);
}
kf5WidgetsAddon.unload();
}
#endif


MainWindow::MainWindow() :
m_workspace( nullptr ),
Expand All @@ -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);
Expand Down

0 comments on commit 158bb50

Please sign in to comment.