Limit height of while position line to height of all tracks (#6509)
* Position line height fits all tracks when line is moved or updated * Refactor track height calculation; create connection to update position line height
This commit is contained in:
@@ -148,6 +148,7 @@ public:
|
||||
return "trackcontainerview";
|
||||
}
|
||||
|
||||
unsigned int totalHeightOfTracks() const;
|
||||
|
||||
RubberBand *rubberBand() const;
|
||||
|
||||
@@ -206,10 +207,9 @@ private:
|
||||
|
||||
RubberBand * m_rubberBand;
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void positionChanged( const lmms::TimePos & _pos );
|
||||
void tracksRealigned();
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -98,6 +98,9 @@ SongEditor::SongEditor( Song * song ) :
|
||||
connect( m_timeLine, SIGNAL(selectionFinished()),
|
||||
this, SLOT(stopRubberBand()));
|
||||
|
||||
// when tracks realign, adjust height of position line
|
||||
connect(this, &TrackContainerView::tracksRealigned, this, &SongEditor::updatePositionLine);
|
||||
|
||||
m_positionLine = new PositionLine(this);
|
||||
static_cast<QVBoxLayout *>( layout() )->insertWidget( 1, m_timeLine );
|
||||
|
||||
@@ -820,7 +823,7 @@ void SongEditor::updatePosition( const TimePos & t )
|
||||
m_positionLine->hide();
|
||||
}
|
||||
|
||||
m_positionLine->setFixedHeight( height() );
|
||||
updatePositionLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -828,7 +831,7 @@ void SongEditor::updatePosition( const TimePos & t )
|
||||
|
||||
void SongEditor::updatePositionLine()
|
||||
{
|
||||
m_positionLine->setFixedHeight( height() );
|
||||
m_positionLine->setFixedHeight(totalHeightOfTracks());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -263,6 +263,8 @@ void TrackContainerView::realignTracks()
|
||||
trackView->show();
|
||||
trackView->update();
|
||||
}
|
||||
|
||||
emit tracksRealigned();
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +489,19 @@ void TrackContainerView::scrollArea::wheelEvent( QWheelEvent * _we )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int TrackContainerView::totalHeightOfTracks() const
|
||||
{
|
||||
unsigned int heightSum = 0;
|
||||
for (auto & trackView : m_trackViews)
|
||||
{
|
||||
heightSum += trackView->getTrack()->getHeight();
|
||||
}
|
||||
return heightSum;
|
||||
}
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
} // namespace lmms
|
||||
} // namespace lmms
|
||||
|
||||
Reference in New Issue
Block a user