From 4e93f51b7515f1f73810917250f95c93c85427cb Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 31 May 2024 23:39:09 +0200 Subject: [PATCH] Adjust rendering of BarModelEditor (#7299) Adjust the rendering of BarModelEditor to make it respect logarithmic and linear models. The code now uses `inverseScaledValue` instead of `value` just like the `Knob` class does when calculating the angle. --- src/gui/widgets/BarModelEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/BarModelEditor.cpp b/src/gui/widgets/BarModelEditor.cpp index 4b02c9634..ae224530d 100644 --- a/src/gui/widgets/BarModelEditor.cpp +++ b/src/gui/widgets/BarModelEditor.cpp @@ -86,7 +86,7 @@ void BarModelEditor::paintEvent(QPaintEvent *event) // Paint the bar // Compute the percentage as: // min + x * (max - min) = v <=> x = (v - min) / (max - min) - auto const percentage = range == 0 ? 1. : (mod->value() - minValue) / range; + auto const percentage = range == 0 ? 1. : (model()->inverseScaledValue(model()->value()) - minValue) / range; int const margin = 3; QMargins const margins(margin, margin, margin, margin);