From aaed66ecebd7053b9784e6523dd02b61ecf44bd2 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Wed, 29 Apr 2015 13:51:42 +0200 Subject: [PATCH 1/2] Add a focusOutEvent to PianoRoll as fix for Issue #1866 --- include/PianoRoll.h | 1 + src/gui/PianoRoll.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 8437c9ad9..639a042a7 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -120,6 +120,7 @@ protected: virtual void paintEvent( QPaintEvent * _pe ); virtual void resizeEvent( QResizeEvent * _re ); virtual void wheelEvent( QWheelEvent * _we ); + virtual void focusOutEvent( QFocusEvent * ); int getKey( int _y ) const; static inline void drawNoteRect( QPainter & _p, int _x, int _y, diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index 266a1415a..01a5de07d 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -3630,6 +3630,19 @@ void PianoRoll::wheelEvent( QWheelEvent * _we ) +void PianoRoll::focusOutEvent( QFocusEvent * ) +{ + for( int i = 0; i < NumKeys; ++i ) + { + m_pattern->instrumentTrack()->pianoModel()->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, -1, i, 0 ) ); + m_pattern->instrumentTrack()->pianoModel()->setKeyState( i, false ); + } + update(); +} + + + + int PianoRoll::getKey( int _y ) const { int key_line_y = keyAreaBottom() - 1; From 0e5c6aeaf81aba05c1285c719747f3822be80c68 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Sun, 24 May 2015 01:42:17 +0200 Subject: [PATCH 2/2] Sets the Focus to the InstrumentTrackWindow if a preset or a sample droped to it. --- src/tracks/InstrumentTrack.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 20b737444..420a6fea1 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1505,6 +1505,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) engine::getSong()->setModified(); event->accept(); + setFocus(); } else if( type == "presetfile" ) { @@ -1516,6 +1517,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) engine::getSong()->setModified(); event->accept(); + setFocus(); } else if( type == "pluginpresetfile" ) { @@ -1530,6 +1532,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) i->loadFile( value ); event->accept(); + setFocus(); } }