diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 9deeeb9e1..c2d94a181 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -117,6 +117,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/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 1ca1a51ca..6e5301bfe 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3342,6 +3342,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; diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index eb6a4a2b7..ebda0d883 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1669,6 +1669,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) Engine::getSong()->setModified(); event->accept(); + setFocus(); } else if( type == "presetfile" ) { @@ -1680,6 +1681,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) Engine::getSong()->setModified(); event->accept(); + setFocus(); } else if( type == "pluginpresetfile" ) { @@ -1694,6 +1696,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) i->loadFile( value ); event->accept(); + setFocus(); } }