Bug 405471 - QQC2 slider behaving badly when initial value is 1
Summary: QQC2 slider behaving badly when initial value is 1
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.56.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-14 16:05 UTC by Filip Fila
Modified: 2019-05-17 13:45 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.59


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Fila 2019-03-14 16:05:36 UTC
SUMMARY
We want to have a slider with the values 1, 2, 3, 4, 5. We set "from" to 1, "to" to 5, "stepSize" to 1. 

Instead of the slider moving between our desired values, it first moves from 1 to about 1.2. Afterwards the slider placement is wrong and is cca 2.4, 3.8, 5.0.

STEPS TO REPRODUCE
1. run the following code in qmlscene:

import QtQuick.Controls 2.5

Slider {
    from: 1
    to: 5
    stepSize: 1
}

OBSERVED RESULT
Slider values are wrong. 

EXPECTED RESULT
Slider values are 1, 2, 3, 4, 5.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.1

ADDITIONAL INFORMATION
QQC1 slider does not suffer from this issue.
Comment 1 Nate Graham 2019-03-14 17:40:14 UTC
Can confirm. You can see this in the wild with the Libinput mouse & touchpad KCMs too.
Comment 2 Christoph Feck 2019-03-31 07:37:45 UTC
Reproducible with the test case with Qt 5.12.2.

Please report this issue directly to Qt developers via https://bugreports.qt.io/
Comment 3 Christoph Feck 2019-03-31 07:39:37 UTC
Please ignore comment #2. I now tested using "XDG_CURRENT_DESKTOP=QT qmlscene test.qml" which works correctly, so the bug is indeed in the Plasma QtQuick style.
Comment 4 Filip Fila 2019-05-15 16:34:30 UTC
Git commit 6d0289d7b284f5074c5f8ffe5ee6879f656e0724 by Filip Fila.
Committed on 15/05/2019 at 16:34.
Pushed by filipf into branch 'master'.

[QQC2 Slider Style] Fix wrong handle positioning when initial value is 1

Summary:
Old code was not reading value properly when initial value was 1, misplacing the handle as a result.

Test Plan:
Tested by running qmlscene with:

```
import QtQuick.Controls 2.5

Slider {
    from: 1
    to: 5
    stepSize: 1
    //orientation: Qt.Vertical
}
```
Tested both in horizontal and vertical orientation.

You can also test this in the Mouse KCM, with the Pointer Speed slider.

Reviewers: mart, #plasma, ngraham, broulik

Reviewed By: mart, #plasma, ngraham

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D21075

M  +3    -2    org.kde.desktop/Slider.qml

https://commits.kde.org/qqc2-desktop-style/6d0289d7b284f5074c5f8ffe5ee6879f656e0724