Bug 473400

Summary: Slider with `live: false` does not update its graphics until released
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: ratijas <me>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, kde, nate, noahadvs, notmart
Priority: NOR Keywords: qt6
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description ratijas 2023-08-15 07:42:13 UTC
SUMMARY

In qqc2-desktop-style, Slider.qml with `live` property set to `false` does not pass intermediate values across the bridge to its StyleItem while  being dragged. This is not how a non-live Slider should work: it should block updates to its `value` property, but still rely on non-blocked read-only `position` or `visualPosition` to update graphics.

STEPS TO REPRODUCE
1. Create a Slider component, add `live: false` binding
2. Start your scratch app, and drag the slider around.

OBSERVED RESULT

Slider's handle only "jumps" to the target value once it is released.

EXPECTED RESULT

Slider's handle should continuously follow the pointer, regardless of Slider's `live` property.

SOFTWARE/OS VERSIONS
KDE Plasma Version: git/master
KDE Frameworks Version: git/master
Qt Version: 6.5
Comment 1 ratijas 2023-08-27 18:19:10 UTC
Git commit 0bf7d834e1df31a639c9e560da4cac7051fce0b2 by ivan tkachenko.
Committed on 27/08/2023 at 20:08.
Pushed by ratijas into branch 'master'.

Slider: Fix non-live sliders, rework bridged values

Similar to the latest ProgressBar rewrite:

> Get rid of nasty math! Embrace simplicity and perfection of `position`!
>
> Now the range of possible bridged values is totally predictable, safe
> from overflows, and precise enough to express fractions of progress
> even on the biggest available monitors.

Expect, here we still have to deal with to/from/stepSzie, because
bridged step needs to be scaled.

But most importantly, `position` receives real-time updates even for
non-live Sliders, while `value` gets stuck until a Slider is released.

M  +6    -8    org.kde.desktop/Slider.qml
M  +34   -1    tests/testBars.qml

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/0bf7d834e1df31a639c9e560da4cac7051fce0b2