From: APTX Date: Sun, 16 Feb 2014 12:44:26 +0000 (+0100) Subject: Center the seek time vertically in the SeekSlider. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=d433ed890268899dcccc325ec02822d9f6a61390;p=aniplayer2.git Center the seek time vertically in the SeekSlider. --- 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));