From 445b55f0f52b7aca7d836ab5553aca61af555e79 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Nov 2021 03:15:07 +0100 Subject: [PATCH] Don't draw position arrow when line is out of view (#6191) Also hides timeline numbers above the piano keys. --- src/gui/TimeLineWidget.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index c9c951901..dc6537ab7 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -238,7 +238,8 @@ void TimeLineWidget::paintEvent( QPaintEvent * ) p.fillRect( 0, 0, width(), height(), p.background() ); // Clip so that we only draw everything starting from the offset - p.setClipRect( m_xOffset, 0, width() - m_xOffset, height() ); + const int leftMargin = m_xOffset + s_posMarkerPixmap->width() / 2; + p.setClipRect(leftMargin, 0, width() - leftMargin, height() ); // Draw the loop rectangle int const & loopRectMargin = getLoopRectangleVerticalPadding(); @@ -296,9 +297,14 @@ void TimeLineWidget::paintEvent( QPaintEvent * ) p.setBrush( Qt::NoBrush ); p.drawRect( innerRectangle ); - // Draw the position marker - p.setOpacity( 0.6 ); - p.drawPixmap( m_posMarkerX, height() - s_posMarkerPixmap->height(), *s_posMarkerPixmap ); + // Only draw the position marker if the position line is in view + if (m_posMarkerX >= m_xOffset && m_posMarkerX < width() - s_posMarkerPixmap->width() / 2) + { + // Let the position marker extrude to the left + p.setClipping(false); + p.setOpacity(0.6); + p.drawPixmap(m_posMarkerX, height() - s_posMarkerPixmap->height(), *s_posMarkerPixmap); + } }