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:
Michael Fulghum
2022-10-04 00:43:23 -05:00
committed by GitHub
parent 6ae075edf3
commit a57265cf8d
3 changed files with 22 additions and 5 deletions

View File

@@ -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();
} ;

View File

@@ -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());
}

View File

@@ -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