Merge lp:~nik90/ubuntu-ui-toolkit/fix-slider-bubble-width into lp:ubuntu-ui-toolkit/staging

Proposed by Nekhelesh Ramananthan on 2015-03-20
Status: Merged
Approved by: Tim Peeters on 2015-03-23
Approved revision: 1457
Merged at revision: 1455
Proposed branch: lp:~nik90/ubuntu-ui-toolkit/fix-slider-bubble-width
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 50 lines (+29/-1)
2 files modified
examples/ubuntu-ui-toolkit-gallery/Sliders.qml (+25/-0)
modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml (+4/-1)
To merge this branch: bzr merge lp:~nik90/ubuntu-ui-toolkit/fix-slider-bubble-width
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-03-23
Tim Peeters 2015-03-20 Approve on 2015-03-23
Review via email: mp+253620@code.launchpad.net

Commit Message

Fixes the slider bubble width to be dynamic and dependent on the label width.

Description of the Change

This MP fixes the slider bubble width to be dynamic and dependent on the label width instead of being static. This would allow the slider bubble to show values like "medium", "slow" etc without it exceeding the bubble width as shown in https://launchpadlibrarian.net/200688179/Screenshot%20at%2022-13-39.png

To post a comment you must log in.
1456. By Nekhelesh Ramananthan on 2015-03-20

Added two properties

Roman Shchekin (mrqtros) wrote :

I think that you should do them private via "__" (double underscore) or internal QtObject. Or you internationally want to show these two new properties to user?

Nekhelesh Ramananthan (nik90) wrote :

That was my initial thought, but on looking at the other properties in SliderStyle.qml and also at ButtonStyle.qml for reference, they all were not private.

Tim Peeters (tpeeters) wrote :

bubbleShape is an internal Item for the style, so the added properties are not public. I think it is good like this.

Perhaps you can add a little example of a slider with a larger bubble width in examples/ubuntu-ui-toolkit-gallery/Sliders.qml ?

1457. By Nekhelesh Ramananthan on 2015-03-20

Added a example of a slider with bubble showing lables

Tim Peeters (tpeeters) wrote :

It works well, thanks.

Approving. I will happrove it when we finish our final landings from staging to vivid.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/ubuntu-ui-toolkit-gallery/Sliders.qml'
2--- examples/ubuntu-ui-toolkit-gallery/Sliders.qml 2015-03-03 13:20:06 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/Sliders.qml 2015-03-20 21:25:24 +0000
4@@ -69,5 +69,30 @@
5 font.weight: Font.Light
6 }
7 }
8+
9+ TemplateFlow {
10+ title: i18n.tr("Labels")
11+
12+ Slider {
13+ id: longBubbleSlider
14+ objectName: "slider_long_bubble"
15+ width: parent.width
16+ value: 50
17+ minimumValue: 0
18+ maximumValue: 100
19+ function formatValue(v) {
20+ if (v < maximumValue/4)
21+ return i18n.tr("Small")
22+ else if (v < maximumValue/1.5)
23+ return i18n.tr("Medium")
24+ else
25+ return i18n.tr("Large")
26+ }
27+ }
28+ Label {
29+ text: i18n.tr("Actual value: %1").arg(longBubbleSlider.value)
30+ font.weight: Font.Light
31+ }
32+ }
33 }
34 }
35
36=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml'
37--- modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml 2015-03-10 12:16:04 +0000
38+++ modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml 2015-03-20 21:25:24 +0000
39@@ -87,7 +87,10 @@
40 BubbleShape {
41 id: bubbleShape
42
43- width: units.gu(8)
44+ property real minimumWidth: units.gu(8)
45+ property real horizontalPadding: units.gu(1)
46+
47+ width: Math.max(minimumWidth, label.implicitWidth + 2*horizontalPadding)
48 height: units.gu(6)
49
50 // FIXME: very temporary implementation

Subscribers

People subscribed via source and target branches