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.
This commit is contained in:
Michael Gregorius
2024-05-31 23:39:09 +02:00
committed by GitHub
parent 37795ae20a
commit 4e93f51b75

View File

@@ -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);