Skip to content

Commit

Permalink
Give focus to AutomationEditor when the window gets the foucs (#5170)
Browse files Browse the repository at this point in the history
This will make shortcuts work on opening the editor.
  • Loading branch information
https://gitlab.com/users/CYBERDEViLNL authored and PhysSong committed Oct 1, 2019
1 parent 8676399 commit 5132d91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ public slots:
signals:
void currentPatternChanged();

protected:
virtual void focusInEvent(QFocusEvent * event);

protected slots:
void play();
void stop();
Expand Down
7 changes: 7 additions & 0 deletions src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ AutomationEditor::AutomationEditor() :
setCurrentPattern( NULL );

setMouseTracking( true );
setFocusPolicy( Qt::StrongFocus );
setFocus();
}


Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 5132d91

Please sign in to comment.