From d433ed890268899dcccc325ec02822d9f6a61390 Mon Sep 17 00:00:00 2001 From: APTX Date: Sun, 16 Feb 2014 13:44:26 +0100 Subject: [PATCH] Center the seek time vertically in the SeekSlider. --- player/seekslider.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/player/seekslider.cpp b/player/seekslider.cpp index 919be60..f913011 100644 --- a/player/seekslider.cpp +++ b/player/seekslider.cpp @@ -98,6 +98,7 @@ void SeekSlider::paintEvent(QPaintEvent *event) // unwatched part p.fillRect(markerPos + markerWidth / 2, seekerTop + 1, seekerWidth - markerPos, seekerHeight - 1, unwatchedPartColor); + // previous locations before seeking int i = 1; for (auto it = previuousPos.constBegin(); it != previuousPos.constEnd(); ++it) { @@ -121,10 +122,11 @@ void SeekSlider::paintEvent(QPaintEvent *event) QRect r = p.fontMetrics().boundingRect(time); int xdelta = markerShadowPos + markerWidth / 2 + 1; + int ydelta = seekerHeight / 2 + r.height() / 2 - 1; if (xdelta + r.width() < width()) - r.translate(xdelta, r.height()); + r.translate(xdelta, ydelta); else - r.translate(markerShadowPos - (markerWidth / 2 + 1) - r.width(), r.height()); + r.translate(markerShadowPos - (markerWidth / 2 + 1) - r.width(), ydelta); p.fillRect(r, toolTipBackgroundColor); p.setPen(QPen(toolTipForegroundColor)); -- 2.52.0