~zsombi/ubuntu-ui-toolkit/theme-as-singleton

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/Slider.qml

  • Committer: Tarmac
  • Author(s): Florian Boucault
  • Date: 2014-01-24 11:56:52 UTC
  • mfrom: (901.1.7 rtl_support)
  • Revision ID: tarmac-20140124115652-nx51bfyrt68bna8e
Added Right-to-Left languages support to most widgets and to the UI Toolkit Gallery.
  
The following widgets now behave properly in RTL environments:
  - List Items
  - Popups
  - Slider
  - TextArea
  - TextField
  - Button
  - ProgressBar
  - Toolbar
  - Header
  - Switch
  
Tabs still need to be reversed.
Relayout issues had to be workarounded (QTBUG 35095) for Label and Row.
. Fixes: https://bugs.launchpad.net/bugs/1181740.

Approved by PS Jenkins bot, Zsombor Egri.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        property real dragInitNormalizedValue: 0.0
142
142
 
143
143
        function normalizedValueFromValue(value) {
144
 
            return MathUtils.clampAndProject(value, slider.minimumValue,
145
 
                                             slider.maximumValue, 0.0, 1.0);
 
144
            if (Qt.application.layoutDirection == Qt.RightToLeft) {
 
145
                return MathUtils.clampAndProject(value, slider.minimumValue,
 
146
                                                 slider.maximumValue, 1.0, 0.0);
 
147
            } else {
 
148
                return MathUtils.clampAndProject(value, slider.minimumValue,
 
149
                                                 slider.maximumValue, 0.0, 1.0);
 
150
            }
 
151
 
146
152
        }
147
153
 
148
154
        function valueFromNormalizedValue(normalizedValue) {
149
 
            return MathUtils.lerp(MathUtils.clamp(normalizedValue, 0.0, 1.0),
150
 
                                  slider.minimumValue, slider.maximumValue);
 
155
            if (Qt.application.layoutDirection == Qt.RightToLeft) {
 
156
                return MathUtils.lerp(MathUtils.clamp(normalizedValue, 0.0, 1.0),
 
157
                                      slider.maximumValue, slider.minimumValue);
 
158
            } else {
 
159
                return MathUtils.lerp(MathUtils.clamp(normalizedValue, 0.0, 1.0),
 
160
                                      slider.minimumValue, slider.maximumValue);
 
161
            }
151
162
        }
152
163
 
153
164
        /* Mimic the behaviour of the 'pressed' property with one important difference: