Skip to content

Commit

Permalink
allow drag track label button for moving track (LMMS#3271)
Browse files Browse the repository at this point in the history
* allow drag track label button for moving track

* improve mouseclick

* improve click 2
  • Loading branch information
BaraMGB authored Jan 23, 2017
1 parent ab48e38 commit 7a92bc7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/TrackLabelButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ public slots:
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );


private:
TrackView * m_trackView;
QString m_iconName;
QLineEdit * m_renameLineEdit;
QRect m_buttonRect;

} ;

Expand Down
16 changes: 15 additions & 1 deletion src/gui/widgets/TrackLabelButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ void TrackLabelButton::mousePressEvent( QMouseEvent * _me )
}
else
{
QToolButton::mousePressEvent( _me );
m_buttonRect = QRect( this->mapToGlobal( pos() ), size() );
_me->ignore();
}
}

Expand All @@ -161,6 +162,19 @@ void TrackLabelButton::mouseDoubleClickEvent( QMouseEvent * _me )



void TrackLabelButton::mouseReleaseEvent(QMouseEvent *_me)
{
if( m_buttonRect.contains( _me->globalPos(), true ) )
{
QToolButton::mousePressEvent( _me );
}
QToolButton::mouseReleaseEvent( _me );
_me->ignore();
}




void TrackLabelButton::paintEvent( QPaintEvent * _pe )
{
if( m_trackView->getTrack()->type() == Track::InstrumentTrack )
Expand Down

0 comments on commit 7a92bc7

Please sign in to comment.