From 382aec66f35978f60a65c5255ab8321f501a2360 Mon Sep 17 00:00:00 2001 From: Colin Wallace Date: Sat, 18 Apr 2015 21:00:02 +0000 Subject: [PATCH] Give focus to the PianoRoll widget when its window is opened --- include/PianoRoll.h | 2 ++ src/gui/editors/PianoRoll.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index f4f313174..9deeeb9e1 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -384,6 +384,8 @@ signals: void currentPatternChanged(); private: + void focusInEvent(QFocusEvent * event); + PianoRoll* m_editor; ComboBox * m_zoomingComboBox; diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 3f79b8488..3c31b7895 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4236,3 +4236,9 @@ QSize PianoRollWindow::sizeHint() const { return {m_toolBar->sizeHint().width() + 10, INITIAL_PIANOROLL_HEIGHT}; } + +void PianoRollWindow::focusInEvent(QFocusEvent * event) +{ + // when the window is given focus, also give focus to the actual piano roll + m_editor->setFocus(event->reason()); +}