Merge lp:~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs into lp:ubuntu-ui-toolkit/staging

Proposed by Andrea Bernabei
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
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)

To post a comment you must log in.
Revision history for this message
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://code.launchpad.net/~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs/+merge/300372/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/1081/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/4509/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/1081/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
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://code.launchpad.net/~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs/+merge/300372/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/834/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/4510/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/834/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
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://code.launchpad.net/~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs/+merge/300372/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/862/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/4511/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/862/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
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://code.launchpad.net/~faenil/ubuntu-ui-toolkit/moreListItemLayoutDocs/+merge/300372/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/1060/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/4512/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/1060/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice docs! Those were long overdue. Thanks!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp'
--- src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-07-07 07:21:48 +0000
+++ src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-07-18 17:41:12 +0000
@@ -44,6 +44,8 @@
44 //Using WrapAnywhere because ElideRight elides too early when used44 //Using WrapAnywhere because ElideRight elides too early when used
45 //together with WrapWord, and that produces an unexpected result.45 //together with WrapWord, and that produces an unexpected result.
46 //This will cover most of the usecases.46 //This will cover most of the usecases.
47 //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to
48 //set wrapMode to NoWrap (see Text docs for more details)
47 m_title->setWrapMode(UCLabel::WrapAnywhere);49 m_title->setWrapMode(UCLabel::WrapAnywhere);
48 m_title->setElideMode(UCLabel::ElideRight);50 m_title->setElideMode(UCLabel::ElideRight);
49 m_title->setMaximumLineCount(1);51 m_title->setMaximumLineCount(1);
@@ -55,6 +57,8 @@
55{57{
56 if (m_subtitle != Q_NULLPTR) {58 if (m_subtitle != Q_NULLPTR) {
57 m_subtitle->setWrapMode(UCLabel::WrapAnywhere);59 m_subtitle->setWrapMode(UCLabel::WrapAnywhere);
60 //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to
61 //set wrapMode to NoWrap (see Text docs for more details)
58 m_subtitle->setElideMode(UCLabel::ElideRight);62 m_subtitle->setElideMode(UCLabel::ElideRight);
59 m_subtitle->setMaximumLineCount(1);63 m_subtitle->setMaximumLineCount(1);
60 m_subtitle->setTextSize(UCLabel::Small);64 m_subtitle->setTextSize(UCLabel::Small);
@@ -65,6 +69,8 @@
65{69{
66 if (m_summary != Q_NULLPTR) {70 if (m_summary != Q_NULLPTR) {
67 m_summary->setWrapMode(UCLabel::WrapAnywhere);71 m_summary->setWrapMode(UCLabel::WrapAnywhere);
72 //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to
73 //set wrapMode to NoWrap (see Text docs for more details)
68 m_summary->setElideMode(UCLabel::ElideRight);74 m_summary->setElideMode(UCLabel::ElideRight);
69 m_summary->setMaximumLineCount(2);75 m_summary->setMaximumLineCount(2);
70 m_summary->setTextSize(UCLabel::Small);76 m_summary->setTextSize(UCLabel::Small);
7177
=== modified file 'src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp'
--- src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-07-07 07:21:48 +0000
+++ src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-07-18 17:41:12 +0000
@@ -40,6 +40,11 @@
40 ListItemLayout is essentially a \l {SlotsLayout} with a predefined40 ListItemLayout is essentially a \l {SlotsLayout} with a predefined
41 \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out41 \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out
42 according to our UI guidelines.42 according to our UI guidelines.
43
44 \b Note: those labels may have properties whose default value is different
45 from what is used by the standard Label component. The default wrapMode,
46 for instance, is different. Have a look at \l {Labels' properties} section.
47
43 This main slot has been optimized to cover most of the usecases48 This main slot has been optimized to cover most of the usecases
44 without compromising performance (read more in \l {Optimizing memory consumption}).49 without compromising performance (read more in \l {Optimizing memory consumption}).
4550
@@ -186,6 +191,39 @@
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)
187 text with dummy content.192 text with dummy content.
188193
194 \section1 Labels' properties
195
196 ListItemLayout's labels are the same component as \l {Label}, but with slightly different
197 default properties. Moreover, \l Label derives from \l {Text}. As a consequence,
198 you can access and override all the properties provided by \l {Text} and \l {Label}, if needed. Please
199 refer to \l {Text}'s and \l {Label}'s documentation to see the list of all the properties.
200
201 The default values for ListItemLayout's labels are defined in the documentation of each label.
202 See \l title, \l subtitle and \l summary.
203
204 \b Note: if you want to change the elide mode of a label to something other than \c Text.ElideRight,
205 make sure its \c wrapMode is set to \c Text.NoWrap. See \l Text::wrapMode for more details.
206
207 \qml
208 import QtQuick 2.4
209 import Ubuntu.Components 1.3
210 Item {
211 width: units.gu(30)
212 height: units.gu(50)
213 ListItem {
214 height: layout.height + (divider.visible ? divider.height : 0)
215 ListItemLayout {
216 id: fileLayout
217 //Let's change the default elide mode to Text.ElideMiddle
218 title.elide: Text.ElideMiddle
219 //ElideMiddle only works if there is no wrapping (see Text::wrapMode doc)
220 title.wrapMode: Text.NoWrap
221 title.text: "Red Roses run no risk, sir, on nurses order."
222 }
223 }
224 }
225 \endqml
226
189 \section1 Optimizing memory consumption227 \section1 Optimizing memory consumption
190228
191 In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot229 In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot
@@ -221,6 +259,7 @@
221259
222 \qml260 \qml
223 ListItem {261 ListItem {
262 height: layout.height + (divider.visible ? divider.height : 0)
224 property alias titleText: layout.title.text263 property alias titleText: layout.title.text
225 ListItemLayout {264 ListItemLayout {
226 id: layout265 id: layout
@@ -301,13 +340,28 @@
301 Text component, as shown in the following example:340 Text component, as shown in the following example:
302341
303 \qml342 \qml
304 Item {343 import QtQuick 2.4
305 ListItemLayout {344 import Ubuntu.Components 1.3
306 title.text: "Hello"345 ListItemLayout {
307 title.color: "yellow"346 height: units.gu(10)
308 }347 width: units.gu(30)
348 title.color: UbuntuColors.orange
349 title.maximumLineCount: 3
350 title.text: "Red Roses\nrun no risk,\nsir, on nurses order."
309 }351 }
310 \endqml352 \endqml
353
354 The default \l Text::elide value for \l title is \c Text.ElideRight.
355
356 The default \l Text::wrapMode is \c Text.WrapAnywhere.
357
358 That means, for instance, that if you want to use a different elide mode, you also have
359 to set wrapMode to \c Text.NoWrap. Refer to the official \l Text documentation for
360 further details.
361
362 The default \l Label::textSize is \c Label.Medium.
363
364 The rest of the properties have the same default values as \l Label.
311*/365*/
312UCLabel *UCListItemLayout::title()366UCLabel *UCListItemLayout::title()
313{367{
@@ -320,6 +374,14 @@
320 This property defines the subtitle label and its properties.374 This property defines the subtitle label and its properties.
321 Styling and font properties can be set by using the prefix375 Styling and font properties can be set by using the prefix
322 \c {subtitle.} in a similar way as shown in \l title.376 \c {subtitle.} in a similar way as shown in \l title.
377
378 The default \l Text::elide value for \l subtitle is \c Text.ElideRight.
379
380 The default \l Text::wrapMode is \c Text.WrapAnywhere.
381
382 The default \l Label::textSize is \c Label.Small.
383
384 The rest of the properties have the same default values as \l Label.
323*/385*/
324UCLabel *UCListItemLayout::subtitle()386UCLabel *UCListItemLayout::subtitle()
325{387{
@@ -332,6 +394,14 @@
332 This property defines the subtitle label and its properties.394 This property defines the subtitle label and its properties.
333 Styling and font properties can be set by using the prefix395 Styling and font properties can be set by using the prefix
334 \c {summary.} in a similar way as shown in \l title.396 \c {summary.} in a similar way as shown in \l title.
397
398 The default \l Text::elide value for \l summary is \c Text.ElideRight.
399
400 The default \l Text::wrapMode is \c Text.WrapAnywhere.
401
402 The default \l Label::textSize is \c Label.Small.
403
404 The rest of the properties have the same default values as \l Label.
335*/405*/
336UCLabel *UCListItemLayout::summary()406UCLabel *UCListItemLayout::summary()
337{407{

Subscribers

People subscribed via source and target branches