Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/clipDelegateLabel into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Tim Peeters
Approved revision: 1565
Merged at revision: 1569
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/clipDelegateLabel
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 143 lines (+52/-48)
2 files modified
examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml (+12/-14)
modules/Ubuntu/Components/1.3/OptionSelectorDelegate.qml (+40/-34)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/clipDelegateLabel
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Approve
Review via email: mp+264741@code.launchpad.net

Commit message

Move delegate's chevron into the row and size it explicitly

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

When the text is too long, can you use Text.elide so that "..." is shown in the end to indicate that not the full text is shown?

review: Needs Fixing
1565. By Cris Dywan

Elide label texts rather than cutting them right off

Revision history for this message
Tim Peeters (tpeeters) wrote :

good, thanks.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
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/OptionSelectors.qml'
2--- examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 2015-04-25 08:18:45 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 2015-07-16 11:03:15 +0000
4@@ -29,23 +29,24 @@
5 anchors.right: parent.right
6 spacing: units.gu(3)
7
8+ property var model: [
9+ i18n.tr("Value 1"),
10+ i18n.tr("This is the second value"),
11+ i18n.tr("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."),
12+ i18n.tr("Once upon a time there was a story nobody told."),
13+ ]
14+
15 OptionSelector {
16- objectName: "optionselector_collapsed"
17- text: i18n.tr("Collapsed")
18- model: [i18n.tr("Value 1"),
19- i18n.tr("Value 2"),
20- i18n.tr("Value 3"),
21- i18n.tr("Value 4")]
22+ objectName: "optionselector_collapsed"
23+ text: i18n.tr("Collapsed")
24+ model: parent.model
25 }
26
27 OptionSelector {
28 objectName: "optionselector_expanded"
29 text: i18n.tr("Expanded")
30 expanded: true
31- model: [i18n.tr("Value 1"),
32- i18n.tr("Value 2"),
33- i18n.tr("Value 3"),
34- i18n.tr("Value 4")]
35+ model: parent.model
36 }
37
38 OptionSelector {
39@@ -53,10 +54,7 @@
40 text: i18n.tr("Multiple Selection")
41 expanded: false
42 multiSelection: true
43- model: [i18n.tr("Value 1"),
44- i18n.tr("Value 2"),
45- i18n.tr("Value 3"),
46- i18n.tr("Value 4")]
47+ model: parent.model
48 }
49
50 OptionSelector {
51
52=== modified file 'modules/Ubuntu/Components/1.3/OptionSelectorDelegate.qml'
53--- modules/Ubuntu/Components/1.3/OptionSelectorDelegate.qml 2015-04-29 07:21:29 +0000
54+++ modules/Ubuntu/Components/1.3/OptionSelectorDelegate.qml 2015-07-16 11:03:15 +0000
55@@ -318,48 +318,54 @@
56 anchors {
57 verticalCenter: parent.verticalCenter
58 }
59+ clip: true
60+ width: option.width - leftIcon.width - image.width
61+ - parent.spacing * 2 - parent.anchors.leftMargin
62+
63 Label {
64 text: option.text === "" ? modelData : option.text
65+ width: parent.width
66+ elide: Text.ElideRight
67 }
68 Label {
69 text: option.subText
70+ width: parent.width
71+ elide: Text.ElideRight
72 visible: option.subText !== "" ? true : false
73 fontSize: "small"
74 }
75 }
76- }
77-
78- Image {
79- id: image
80-
81- width: units.gu(2)
82- height: units.gu(2)
83- source: listView.expanded || listView.multiSelection ? listView.container.tick : listView.container.chevron
84- opacity: option.selected ? 1.0 : 0.0
85- anchors {
86- right: parent.right
87- rightMargin: units.gu(2)
88- verticalCenter: parent.verticalCenter
89- }
90-
91- //Our behaviour is only enabled for our expanded list due to flickering bugs in relation to all this other animations running on the expanding version.
92- Behavior on opacity {
93- enabled: listView.expanded
94-
95- Toolkit.UbuntuNumberAnimation {
96- properties: "opacity"
97- duration: Toolkit.UbuntuAnimation.FastDuration
98- }
99- }
100-
101- ShaderEffect {
102- property color colour: assetColour
103- property Image source: parent
104-
105- width: source.width
106- height: source.height
107-
108- fragmentShader: fragColourShader
109- }
110+
111+ Image {
112+ id: image
113+
114+ width: units.gu(2)
115+ height: units.gu(2)
116+ source: listView.expanded || listView.multiSelection ? listView.container.tick : listView.container.chevron
117+ opacity: option.selected ? 1.0 : 0.0
118+ anchors {
119+ verticalCenter: parent.verticalCenter
120+ }
121+
122+ //Our behaviour is only enabled for our expanded list due to flickering bugs in relation to all this other animations running on the expanding version.
123+ Behavior on opacity {
124+ enabled: listView.expanded
125+
126+ Toolkit.UbuntuNumberAnimation {
127+ properties: "opacity"
128+ duration: Toolkit.UbuntuAnimation.FastDuration
129+ }
130+ }
131+
132+ ShaderEffect {
133+ property color colour: assetColour
134+ property Image source: parent
135+
136+ width: source.width
137+ height: source.height
138+
139+ fragmentShader: fragColourShader
140+ }
141+ }
142 }
143 }

Subscribers

People subscribed via source and target branches