From 8c824e26f2faf77539a34294ee1eff54717b8e06 Mon Sep 17 00:00:00 2001 From: Eric Fontaine Date: Tue, 21 Mar 2017 07:35:47 -0400 Subject: [PATCH] fix #182171 correct update rect to cover entire meter rect Increased the QRect to cover entire meter are which is updated, to prevent a visual glitch whereby leftmost two columns of pixels weren't updated. But since since the notches aren't redrawn when synth updates level, notches have been shifted a bit and end right before the mixer redraw area so they'll no longer overlap, which prevents a visual glitch whereby the notches would flicker off when mixer was redrawn. --- awl/mslider.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/awl/mslider.cpp b/awl/mslider.cpp index b7130d7592..aa44d2f6c2 100644 --- a/awl/mslider.cpp +++ b/awl/mslider.cpp @@ -23,6 +23,8 @@ namespace Awl { +#define METER_LEFT_EDGE 18 + //--------------------------------------------------------- // MeterSlider //--------------------------------------------------------- @@ -82,7 +84,7 @@ void MeterSlider::setMeterVal(int channel, double v, double peak) if (mustRedraw) { int kh = sliderSize().height(); int mh = height() - kh; - update(20, kh / 2, _meterWidth-1, mh); + update(METER_LEFT_EDGE, kh / 2, _meterWidth-1, mh); } } @@ -179,7 +181,7 @@ void MeterSlider::paintEvent(QPaintEvent* ev) //--------------------------------------------------- int mw = _meterWidth / _channel; - int x = 18; + int x = METER_LEFT_EDGE; int y1 = kh / 2; int y3 = h - y1; @@ -210,7 +212,7 @@ void MeterSlider::paintEvent(QPaintEvent* ev) x += 4; // optimize common case: - if (ev->rect() == QRect(20, kh / 2, _meterWidth - 1, mh)) + if (ev->rect() == QRect(METER_LEFT_EDGE, kh / 2, _meterWidth - 1, mh)) return; QColor sc(isEnabled() ? _scaleColor : Qt::gray); @@ -239,14 +241,14 @@ void MeterSlider::paintEvent(QPaintEvent* ev) h = y1 + lrint(i * mh / range); s.setNum(i); if (i == 0) { - p.drawText(QRect(0, h - 3, 15, 9), Qt::AlignRight, QString::fromStdString("dB")); - p.drawLine(18, h + 1, 23, h + 1); + p.drawText(QRect(0, h - 3, METER_LEFT_EDGE - 3, 9), Qt::AlignRight, QString::fromStdString("dB")); + p.drawLine(METER_LEFT_EDGE - 1, h + 1, METER_LEFT_EDGE - 1, h + 1); continue; } else if (i == range) h -= 2; - p.drawText(QRect(0, h - 3, 15, 9), Qt::AlignRight, QString::fromStdString("-") + s); - p.drawLine(18, h + 1, 23, h + 1); + p.drawText(QRect(0, h - 3, METER_LEFT_EDGE - 3, 9), Qt::AlignRight, QString::fromStdString("-") + s); + p.drawLine(METER_LEFT_EDGE - 1, h + 1, METER_LEFT_EDGE - 1, h + 1); } //---------------------------------------------------