From f957646568ca2f75527da6c5d1102c178023a489 Mon Sep 17 00:00:00 2001 From: Lukas Waslowski Date: Fri, 26 Apr 2024 13:45:09 +0000 Subject: [PATCH] CrateFeature: Defer initActions invocation until bindLibraryWidget is called --- src/library/trackset/crate/cratefeature.cpp | 9 +++++++-- src/library/trackset/crate/cratefeature.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/library/trackset/crate/cratefeature.cpp b/src/library/trackset/crate/cratefeature.cpp index 5876aec22a8b..5b5c632d10a8 100644 --- a/src/library/trackset/crate/cratefeature.cpp +++ b/src/library/trackset/crate/cratefeature.cpp @@ -7,6 +7,7 @@ #include #include "analyzer/analyzerscheduledtrack.h" +#include "controllers/keyboard/keyboardeventfilter.h" #include "library/export/trackexportwizard.h" #include "library/library.h" #include "library/library_prefs.h" @@ -60,7 +61,7 @@ CrateFeature::CrateFeature(Library* pLibrary, connectTrackCollection(); } -void CrateFeature::initActions() { +void CrateFeature::initActions(KeyboardEventFilter* pKeyboard) { m_pCreateCrateAction = make_parented(tr("Create New Crate"), this); connect(m_pCreateCrateAction.get(), &QAction::triggered, @@ -68,7 +69,11 @@ void CrateFeature::initActions() { &CrateFeature::slotCreateCrate); m_pRenameCrateAction = make_parented(tr("Rename"), this); - m_pRenameCrateAction->setShortcut(kRenameSidebarItemShortcutKey); + pKeyboard->registerActionForShortcut( + m_pRenameCrateAction, + ConfigKey("[Library]", "EditItem"), + QKeySequence(kRenameSidebarItemShortcutKey).toString(), + true); connect(m_pRenameCrateAction.get(), &QAction::triggered, this, diff --git a/src/library/trackset/crate/cratefeature.h b/src/library/trackset/crate/cratefeature.h index 0289a6e20609..bf68902f73a9 100644 --- a/src/library/trackset/crate/cratefeature.h +++ b/src/library/trackset/crate/cratefeature.h @@ -77,7 +77,7 @@ class CrateFeature : public BaseTrackSetFeature { void slotUpdateCrateLabels(const QSet& updatedCrateIds); private: - void initActions(); + void initActions(KeyboardEventFilter* pKeyboard); void connectLibrary(Library* pLibrary); void connectTrackCollection();