allow drag track label button for moving track (#3271)

* allow drag track label button for moving track

* improve mouseclick

* improve click 2
This commit is contained in:
Steffen Baranowsky
2017-01-23 09:35:43 +01:00
committed by GitHub
parent 349f27f819
commit c5aa22663e
2 changed files with 17 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ protected:
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 );
@@ -58,6 +59,7 @@ private:
TrackView * m_trackView;
QString m_iconName;
QLineEdit * m_renameLineEdit;
QRect m_buttonRect;
} ;

View File

@@ -146,7 +146,8 @@ void TrackLabelButton::mousePressEvent( QMouseEvent * _me )
}
else
{
QToolButton::mousePressEvent( _me );
m_buttonRect = QRect( this->mapToGlobal( pos() ), size() );
_me->ignore();
}
}
@@ -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 )