diff --git a/include/TrackContainerView.h b/include/TrackContainerView.h index 116fd68f9..444420d98 100644 --- a/include/TrackContainerView.h +++ b/include/TrackContainerView.h @@ -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(); } ; diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 330216e43..5fb11ee32 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -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( 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()); } diff --git a/src/gui/editors/TrackContainerView.cpp b/src/gui/editors/TrackContainerView.cpp index 966228ac8..351fe8295 100644 --- a/src/gui/editors/TrackContainerView.cpp +++ b/src/gui/editors/TrackContainerView.cpp @@ -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 \ No newline at end of file +} // namespace lmms