Merge lp:~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs into lp:ubuntu-ui-toolkit/staging
- moreListItemLayoutDocs
- Merge into staging
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrea Bernabei | ||||
Approved revision: | 1826 | ||||
Merged at revision: | 2040 | ||||
Proposed branch: | lp:~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs | ||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||
Diff against target: |
158 lines (+81/-5) 2 files modified
src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp (+6/-0) src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp (+75/-5) |
||||
To merge this branch: | bzr merge lp:~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Cris Dywan | Approve | ||
Jonas G. Drange (community) | Approve | ||
Review via email: mp+300372@code.launchpad.net |
Commit message
ListItemLayout doc: add elide mode change example and add section about labels default properties values
Description of the change
Add some documentation to ListItemLayout docs, in particular:
- explain that the some properties of ListItemLayout's labels have different default values from what is used by Label component
- explain that changing "elide" also requires disabling wrapping (see bug#1603450)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Jonas G. Drange (jonas-drange) wrote : | # |
This will reduce confusion from trying to apply e.g. Text.ElideMiddle on ListItemLayout's title element.
Certainly fixes bug 1603450.
Thanks!
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Cris Dywan (kalikiana) wrote : | # |
Nice docs! Those were long overdue. Thanks!
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1826
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp' | |||
2 | --- src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-07-07 07:21:48 +0000 | |||
3 | +++ src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-07-18 17:41:12 +0000 | |||
4 | @@ -44,6 +44,8 @@ | |||
5 | 44 | //Using WrapAnywhere because ElideRight elides too early when used | 44 | //Using WrapAnywhere because ElideRight elides too early when used |
6 | 45 | //together with WrapWord, and that produces an unexpected result. | 45 | //together with WrapWord, and that produces an unexpected result. |
7 | 46 | //This will cover most of the usecases. | 46 | //This will cover most of the usecases. |
8 | 47 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
9 | 48 | //set wrapMode to NoWrap (see Text docs for more details) | ||
10 | 47 | m_title->setWrapMode(UCLabel::WrapAnywhere); | 49 | m_title->setWrapMode(UCLabel::WrapAnywhere); |
11 | 48 | m_title->setElideMode(UCLabel::ElideRight); | 50 | m_title->setElideMode(UCLabel::ElideRight); |
12 | 49 | m_title->setMaximumLineCount(1); | 51 | m_title->setMaximumLineCount(1); |
13 | @@ -55,6 +57,8 @@ | |||
14 | 55 | { | 57 | { |
15 | 56 | if (m_subtitle != Q_NULLPTR) { | 58 | if (m_subtitle != Q_NULLPTR) { |
16 | 57 | m_subtitle->setWrapMode(UCLabel::WrapAnywhere); | 59 | m_subtitle->setWrapMode(UCLabel::WrapAnywhere); |
17 | 60 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
18 | 61 | //set wrapMode to NoWrap (see Text docs for more details) | ||
19 | 58 | m_subtitle->setElideMode(UCLabel::ElideRight); | 62 | m_subtitle->setElideMode(UCLabel::ElideRight); |
20 | 59 | m_subtitle->setMaximumLineCount(1); | 63 | m_subtitle->setMaximumLineCount(1); |
21 | 60 | m_subtitle->setTextSize(UCLabel::Small); | 64 | m_subtitle->setTextSize(UCLabel::Small); |
22 | @@ -65,6 +69,8 @@ | |||
23 | 65 | { | 69 | { |
24 | 66 | if (m_summary != Q_NULLPTR) { | 70 | if (m_summary != Q_NULLPTR) { |
25 | 67 | m_summary->setWrapMode(UCLabel::WrapAnywhere); | 71 | m_summary->setWrapMode(UCLabel::WrapAnywhere); |
26 | 72 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
27 | 73 | //set wrapMode to NoWrap (see Text docs for more details) | ||
28 | 68 | m_summary->setElideMode(UCLabel::ElideRight); | 74 | m_summary->setElideMode(UCLabel::ElideRight); |
29 | 69 | m_summary->setMaximumLineCount(2); | 75 | m_summary->setMaximumLineCount(2); |
30 | 70 | m_summary->setTextSize(UCLabel::Small); | 76 | m_summary->setTextSize(UCLabel::Small); |
31 | 71 | 77 | ||
32 | === modified file 'src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp' | |||
33 | --- src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-07-07 07:21:48 +0000 | |||
34 | +++ src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-07-18 17:41:12 +0000 | |||
35 | @@ -40,6 +40,11 @@ | |||
36 | 40 | ListItemLayout is essentially a \l {SlotsLayout} with a predefined | 40 | ListItemLayout is essentially a \l {SlotsLayout} with a predefined |
37 | 41 | \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out | 41 | \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out |
38 | 42 | according to our UI guidelines. | 42 | according to our UI guidelines. |
39 | 43 | |||
40 | 44 | \b Note: those labels may have properties whose default value is different | ||
41 | 45 | from what is used by the standard Label component. The default wrapMode, | ||
42 | 46 | for instance, is different. Have a look at \l {Labels' properties} section. | ||
43 | 47 | |||
44 | 43 | This main slot has been optimized to cover most of the usecases | 48 | This main slot has been optimized to cover most of the usecases |
45 | 44 | without compromising performance (read more in \l {Optimizing memory consumption}). | 49 | without compromising performance (read more in \l {Optimizing memory consumption}). |
46 | 45 | 50 | ||
47 | @@ -186,6 +191,39 @@ | |||
48 | 186 | to have the same height even without having to fill \l subtitle's (or summary's) | 191 | to have the same height even without having to fill \l subtitle's (or summary's) |
49 | 187 | text with dummy content. | 192 | text with dummy content. |
50 | 188 | 193 | ||
51 | 194 | \section1 Labels' properties | ||
52 | 195 | |||
53 | 196 | ListItemLayout's labels are the same component as \l {Label}, but with slightly different | ||
54 | 197 | default properties. Moreover, \l Label derives from \l {Text}. As a consequence, | ||
55 | 198 | you can access and override all the properties provided by \l {Text} and \l {Label}, if needed. Please | ||
56 | 199 | refer to \l {Text}'s and \l {Label}'s documentation to see the list of all the properties. | ||
57 | 200 | |||
58 | 201 | The default values for ListItemLayout's labels are defined in the documentation of each label. | ||
59 | 202 | See \l title, \l subtitle and \l summary. | ||
60 | 203 | |||
61 | 204 | \b Note: if you want to change the elide mode of a label to something other than \c Text.ElideRight, | ||
62 | 205 | make sure its \c wrapMode is set to \c Text.NoWrap. See \l Text::wrapMode for more details. | ||
63 | 206 | |||
64 | 207 | \qml | ||
65 | 208 | import QtQuick 2.4 | ||
66 | 209 | import Ubuntu.Components 1.3 | ||
67 | 210 | Item { | ||
68 | 211 | width: units.gu(30) | ||
69 | 212 | height: units.gu(50) | ||
70 | 213 | ListItem { | ||
71 | 214 | height: layout.height + (divider.visible ? divider.height : 0) | ||
72 | 215 | ListItemLayout { | ||
73 | 216 | id: fileLayout | ||
74 | 217 | //Let's change the default elide mode to Text.ElideMiddle | ||
75 | 218 | title.elide: Text.ElideMiddle | ||
76 | 219 | //ElideMiddle only works if there is no wrapping (see Text::wrapMode doc) | ||
77 | 220 | title.wrapMode: Text.NoWrap | ||
78 | 221 | title.text: "Red Roses run no risk, sir, on nurses order." | ||
79 | 222 | } | ||
80 | 223 | } | ||
81 | 224 | } | ||
82 | 225 | \endqml | ||
83 | 226 | |||
84 | 189 | \section1 Optimizing memory consumption | 227 | \section1 Optimizing memory consumption |
85 | 190 | 228 | ||
86 | 191 | In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot | 229 | In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot |
87 | @@ -221,6 +259,7 @@ | |||
88 | 221 | 259 | ||
89 | 222 | \qml | 260 | \qml |
90 | 223 | ListItem { | 261 | ListItem { |
91 | 262 | height: layout.height + (divider.visible ? divider.height : 0) | ||
92 | 224 | property alias titleText: layout.title.text | 263 | property alias titleText: layout.title.text |
93 | 225 | ListItemLayout { | 264 | ListItemLayout { |
94 | 226 | id: layout | 265 | id: layout |
95 | @@ -301,13 +340,28 @@ | |||
96 | 301 | Text component, as shown in the following example: | 340 | Text component, as shown in the following example: |
97 | 302 | 341 | ||
98 | 303 | \qml | 342 | \qml |
104 | 304 | Item { | 343 | import QtQuick 2.4 |
105 | 305 | ListItemLayout { | 344 | import Ubuntu.Components 1.3 |
106 | 306 | title.text: "Hello" | 345 | ListItemLayout { |
107 | 307 | title.color: "yellow" | 346 | height: units.gu(10) |
108 | 308 | } | 347 | width: units.gu(30) |
109 | 348 | title.color: UbuntuColors.orange | ||
110 | 349 | title.maximumLineCount: 3 | ||
111 | 350 | title.text: "Red Roses\nrun no risk,\nsir, on nurses order." | ||
112 | 309 | } | 351 | } |
113 | 310 | \endqml | 352 | \endqml |
114 | 353 | |||
115 | 354 | The default \l Text::elide value for \l title is \c Text.ElideRight. | ||
116 | 355 | |||
117 | 356 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
118 | 357 | |||
119 | 358 | That means, for instance, that if you want to use a different elide mode, you also have | ||
120 | 359 | to set wrapMode to \c Text.NoWrap. Refer to the official \l Text documentation for | ||
121 | 360 | further details. | ||
122 | 361 | |||
123 | 362 | The default \l Label::textSize is \c Label.Medium. | ||
124 | 363 | |||
125 | 364 | The rest of the properties have the same default values as \l Label. | ||
126 | 311 | */ | 365 | */ |
127 | 312 | UCLabel *UCListItemLayout::title() | 366 | UCLabel *UCListItemLayout::title() |
128 | 313 | { | 367 | { |
129 | @@ -320,6 +374,14 @@ | |||
130 | 320 | This property defines the subtitle label and its properties. | 374 | This property defines the subtitle label and its properties. |
131 | 321 | Styling and font properties can be set by using the prefix | 375 | Styling and font properties can be set by using the prefix |
132 | 322 | \c {subtitle.} in a similar way as shown in \l title. | 376 | \c {subtitle.} in a similar way as shown in \l title. |
133 | 377 | |||
134 | 378 | The default \l Text::elide value for \l subtitle is \c Text.ElideRight. | ||
135 | 379 | |||
136 | 380 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
137 | 381 | |||
138 | 382 | The default \l Label::textSize is \c Label.Small. | ||
139 | 383 | |||
140 | 384 | The rest of the properties have the same default values as \l Label. | ||
141 | 323 | */ | 385 | */ |
142 | 324 | UCLabel *UCListItemLayout::subtitle() | 386 | UCLabel *UCListItemLayout::subtitle() |
143 | 325 | { | 387 | { |
144 | @@ -332,6 +394,14 @@ | |||
145 | 332 | This property defines the subtitle label and its properties. | 394 | This property defines the subtitle label and its properties. |
146 | 333 | Styling and font properties can be set by using the prefix | 395 | Styling and font properties can be set by using the prefix |
147 | 334 | \c {summary.} in a similar way as shown in \l title. | 396 | \c {summary.} in a similar way as shown in \l title. |
148 | 397 | |||
149 | 398 | The default \l Text::elide value for \l summary is \c Text.ElideRight. | ||
150 | 399 | |||
151 | 400 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
152 | 401 | |||
153 | 402 | The default \l Label::textSize is \c Label.Small. | ||
154 | 403 | |||
155 | 404 | The rest of the properties have the same default values as \l Label. | ||
156 | 335 | */ | 405 | */ |
157 | 336 | UCLabel *UCListItemLayout::summary() | 406 | UCLabel *UCListItemLayout::summary() |
158 | 337 | { | 407 | { |
FAILED: Continuous integration, rev:1826 /code.launchpad .net/~faenil/ ubuntu- ui-toolkit/ moreListItemLay outDocs/ +merge/ 300372/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/ /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 1081/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/4509/ console
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 1081/rebuild
https:/