Skip to content

Commit

Permalink
fix hanging mouse in piano roll (#4822) (#4960)
Browse files Browse the repository at this point in the history
* fix hanging mouse in piano roll (#4822)

* fix hanging mouse in automation & pianoroll (#4822);

* fix hanging mouse in automation & pianoroll (#4822)

removed TODO comment that I forgot in the code
  • Loading branch information
sharpblade4 authored and BaraMGB committed May 6, 2019
1 parent 9ff882d commit 3dcffbf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/gui/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppt,

m_xOffset -= s_posMarkerPixmap->width() / 2;

setMouseTracking(true);
m_pos.m_timeLine = this;

QTimer * updateTimer = new QTimer( this );
Expand Down Expand Up @@ -365,6 +366,7 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )

void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
{
parentWidget()->update(); // essential for widgets that this timeline had taken their mouse move event from.
const MidiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * MidiTime::ticksPerTact() / m_ppt );

switch( m_action )
Expand Down
9 changes: 6 additions & 3 deletions src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ void AutomationEditor::leaveEvent(QEvent * e )
{
QApplication::restoreOverrideCursor();
}

QWidget::leaveEvent( e );
update();
}


Expand Down Expand Up @@ -1510,8 +1510,11 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
case SELECT: cursor = s_toolSelect; break;
case MOVE: cursor = s_toolMove; break;
}
p.drawPixmap( mapFromGlobal( QCursor::pos() ) + QPoint( 8, 8 ),
*cursor );
QPoint mousePosition = mapFromGlobal( QCursor::pos() );
if( cursor != NULL && mousePosition.y() > TOP_MARGIN + SCROLLBAR_SIZE)
{
p.drawPixmap( mousePosition + QPoint( 8, 8 ), *cursor );
}
}


Expand Down
7 changes: 4 additions & 3 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ void PianoRoll::leaveEvent(QEvent * e )

QWidget::leaveEvent( e );
s_textFloat->hide();
update(); // cleaning inner mouse-related graphics
}


Expand Down Expand Up @@ -3167,10 +3168,10 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
case ModeSelect: cursor = s_toolSelect; break;
case ModeEditDetuning: cursor = s_toolOpen; break;
}
if( cursor != NULL )
QPoint mousePosition = mapFromGlobal( QCursor::pos() );
if( cursor != NULL && mousePosition.y() > keyAreaTop() && mousePosition.x() > noteEditLeft())
{
p.drawPixmap( mapFromGlobal( QCursor::pos() ) + QPoint( 8, 8 ),
*cursor );
p.drawPixmap( mousePosition + QPoint( 8, 8 ), *cursor );
}
}

Expand Down

0 comments on commit 3dcffbf

Please sign in to comment.