Skip to content

Commit

Permalink
Adjust rendering of BarModelEditor (LMMS#7299)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelgregorius authored and Rossmaxx committed Jun 15, 2024
1 parent ecc8a66 commit 2ae9ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/widgets/BarModelEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2ae9ad4

Please sign in to comment.