Skip to content

Commit

Permalink
Merge pull request #2027 from BaraMGB/#1866
Browse files Browse the repository at this point in the history
Add a focusOutEvent to PianoRoll as fix for Issue #1866
  • Loading branch information
tresf committed Apr 30, 2015
2 parents 6608682 + aaed66e commit 388dfbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class PianoRoll : public QWidget, public SerializingObject
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,
Expand Down
13 changes: 13 additions & 0 deletions src/gui/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 388dfbc

Please sign in to comment.