From 3cb95611b7ee35e343bfddf39c6ccb83f55a616f Mon Sep 17 00:00:00 2001 From: "https://gitlab.com/users/CYBERDEViLNL" <1148379+CYBERDEViLNL@users.noreply.github.com> Date: Wed, 2 Oct 2019 01:00:11 +0200 Subject: [PATCH] Give focus to AutomationEditor when the window gets the foucs (#5170) This will make shortcuts work on opening the editor. --- include/AutomationEditor.h | 3 +++ src/gui/editors/AutomationEditor.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 9705c5efa6a..968bb34bef9 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -297,6 +297,9 @@ public slots: signals: void currentPatternChanged(); +protected: + virtual void focusInEvent(QFocusEvent * event); + protected slots: void play(); void stop(); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 94e9d5cc86a..7583501c78e 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -198,6 +198,8 @@ AutomationEditor::AutomationEditor() : setCurrentPattern( NULL ); setMouseTracking( true ); + setFocusPolicy( Qt::StrongFocus ); + setFocus(); } @@ -2516,6 +2518,11 @@ void AutomationEditorWindow::clearCurrentPattern() setCurrentPattern(nullptr); } +void AutomationEditorWindow::focusInEvent(QFocusEvent * event) +{ + m_editor->setFocus( event->reason() ); +} + void AutomationEditorWindow::play() { m_editor->play();