Merge lp:~tpeeters/ubuntu-ui-toolkit/ActionBar-colors into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters on 2016-07-14
Status: Merged
Approved by: Tim Peeters on 2016-07-19
Approved revision: 2054
Merged at revision: 2037
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/ActionBar-colors
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/fixGroupedStyleProperties
Diff against target: 595 lines (+257/-28)
11 files modified
components.api (+10/-0)
src/Ubuntu/Components/1.3/PageHeader.qml (+6/-0)
src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml (+12/-2)
src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml (+56/-0)
src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml (+7/-0)
src/Ubuntu/Components/Styles/Styles.pro (+1/-0)
src/Ubuntu/Components/Styles/qmldir (+1/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml (+36/-6)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+19/-2)
tests/unit/visual/tst_actionbar.13.qml (+78/-17)
tests/unit/visual/tst_pageheader.13.qml (+31/-1)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/ActionBar-colors
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration 2016-07-14 Approve on 2016-07-19
Christian Dywan 2016-07-14 Approve on 2016-07-19
Review via email: mp+300051@code.launchpad.net

This proposal supersedes a proposal from 2016-07-04.

Commit Message

Configure colors of the buttons in the ActionBar and PageHeader through their Styles.

Description of the Change

It was already possible to control the icon colors somewhat by overriding the default delegate for the icon buttons in the ActionBar and PageHeader, but the new way is more convenient and 'cleaner'.

The Toolbar also makes use of ActionBar, but it still works as it is without changes, and ToolbarStyle will be completely replaced in my next MR so I did not make the color configuration available there yet.

tst_pageheader.13.qml was updated with a switch that changes the header colors for manual validation.

To post a comment you must log in.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Christian Dywan (kalikiana) wrote : Posted in a previous version of this proposal

> - backgroundColor (background color of the full ActionBar)
> - pressedBackgroundColor (background color of the button when pressed)
That seems shaky. Two times a background color value, but applied to either the bar as a whole or individual buttons. You can't know from the name - ActionBarStyle even uses the backgroundColor for both the buttons and the whole bar, is this intentional? {pressedB,b}uttonBackgroundColor" would be clearer.

review: Needs Information
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

Ok, updated. Now there is a backgroundColor and pressedButtonBackgroundColor.

The background color is indeed used for the whole ActionBar/PageHeader, so when the button is not pressed, it does not need (or have) a background color. When you pressed the button its color is set to pressedButtonBackgroundColor.

ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Timo Jyrinki (timo-jyrinki) wrote :

armhf pbuilder would now be fixed but this MP seems to have other problems too FAIL! : components::tst_actionbar::compile() module "QtQuick.Layouts" version 1.2 is not installed

Christian Dywan (kalikiana) wrote :

Looks lovely now with the grouped properties.

You may want to use QtQuick.Layouts 1.1 - CI still fails on those imports.

review: Needs Fixing
Christian Dywan (kalikiana) wrote :

Thanks!

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 'components.api'
2--- components.api 2016-07-04 16:14:54 +0000
3+++ components.api 2016-07-19 11:27:28 +0000
4@@ -36,6 +36,8 @@
5 property Component delegate
6 property int numberOfSlots
7 Ubuntu.Components.Styles.ActionBarStyle 1.3: Item
8+ property color backgroundColor
9+ readonly property ActionItemProperties buttons
10 property Component defaultDelegate
11 property int defaultNumberOfSlots
12 property string overflowIconName
13@@ -54,6 +56,13 @@
14 function trigger(var value)
15 function trigger()
16 property string text
17+Ubuntu.Components.Styles.ActionItemProperties 1.3: QtObject
18+ property color backgroundColor
19+ property color disabledBackgroundColor
20+ property color disabledForegroundColor
21+ property color foregroundColor
22+ property color pressedBackgroundColor
23+ property color pressedForegroundColor
24 Ubuntu.Components.ActionList 1.0 0.1: QtObject
25 property list<Action> actions
26 default property list<Action> children
27@@ -832,6 +841,7 @@
28 readonly property ActionBar trailingActionBar
29 Ubuntu.Components.Styles.PageHeaderStyle 1.3: Item
30 property color backgroundColor
31+ readonly property ActionItemProperties buttons
32 property double contentHeight
33 property Component defaultActionDelegate
34 property color disabledForegroundColor
35
36=== modified file 'src/Ubuntu/Components/1.3/PageHeader.qml'
37--- src/Ubuntu/Components/1.3/PageHeader.qml 2016-06-14 14:37:54 +0000
38+++ src/Ubuntu/Components/1.3/PageHeader.qml 2016-07-19 11:27:28 +0000
39@@ -181,7 +181,9 @@
40 actions: header.navigationActions
41 visible: leading.width > 0 // at least 1 visible action
42 StyleHints {
43+ ignoreUnknownProperties: false
44 overflowIconName: "navigation-menu"
45+ backgroundColor: header.__styleInstance.backgroundColor
46 }
47 }
48
49@@ -227,6 +229,10 @@
50 numberOfSlots: MathUtils.clamp(0.3*header.width/units.gu(4), 3, 6)
51 delegate: header.__styleInstance.defaultActionDelegate
52 visible: trailing.width > 0 // at least 1 visible action
53+ StyleHints {
54+ ignoreUnknownProperties: false
55+ backgroundColor: header.__styleInstance.backgroundColor
56+ }
57 }
58
59 /*!
60
61=== modified file 'src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml'
62--- src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml 2015-10-15 14:17:25 +0000
63+++ src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml 2016-07-19 11:27:28 +0000
64@@ -1,5 +1,5 @@
65 /*
66- * Copyright 2015 Canonical Ltd.
67+ * Copyright 2016 Canonical Ltd.
68 *
69 * This program is free software; you can redistribute it and/or modify
70 * it under the terms of the GNU Lesser General Public License as published by
71@@ -17,7 +17,7 @@
72
73 /*!
74 \qmltype ActionBarStyle
75- \inqmlmodule Ubuntu.Components.Styles 1.1
76+ \inqmlmodule Ubuntu.Components.Styles 1.3
77 \ingroup style-api
78 \brief Style API for action bar.
79
80@@ -25,6 +25,16 @@
81 */
82 Item {
83 /*!
84+ The color of the background of the action bar.
85+ */
86+ property color backgroundColor
87+
88+ /*!
89+ Configuration of the colors of the action buttons in the action bar.
90+ */
91+ readonly property ActionItemProperties buttons: ActionItemProperties { }
92+
93+ /*!
94 The default action delegate if the styled item does
95 not provide a different delegate.
96 */
97
98=== added file 'src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml'
99--- src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml 1970-01-01 00:00:00 +0000
100+++ src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml 2016-07-19 11:27:28 +0000
101@@ -0,0 +1,56 @@
102+/*
103+ * Copyright 2016 Canonical Ltd.
104+ *
105+ * This program is free software; you can redistribute it and/or modify
106+ * it under the terms of the GNU Lesser General Public License as published by
107+ * the Free Software Foundation; version 3.
108+ *
109+ * This program is distributed in the hope that it will be useful,
110+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112+ * GNU Lesser General Public License for more details.
113+ *
114+ * You should have received a copy of the GNU Lesser General Public License
115+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
116+ */
117+import QtQuick 2.4
118+
119+/*!
120+ \qmltype ButtonProperties
121+ \inqmlmodule Ubuntu.Components.Styles 1.3
122+ \ingroup style-api
123+ \brief Color properties for buttons.
124+
125+ Defines the colors of buttons.
126+ */
127+QtObject {
128+ /*!
129+ The foreground color of an unpressed enabled button.
130+ */
131+ property color foregroundColor
132+
133+ /*!
134+ The foreground color of a disabled button.
135+ */
136+ property color disabledForegroundColor
137+
138+ /*!
139+ The foreground color of a button when being pressed.
140+ */
141+ property color pressedForegroundColor
142+
143+ /*!
144+ The background color of an unpressed enabled button.
145+ */
146+ property color backgroundColor
147+
148+ /*!
149+ The background color of a disabled button.
150+ */
151+ property color disabledBackgroundColor
152+
153+ /*!
154+ The background color of a button when being pressed.
155+ */
156+ property color pressedBackgroundColor
157+}
158
159=== modified file 'src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml'
160--- src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml 2016-03-30 15:12:36 +0000
161+++ src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml 2016-07-19 11:27:28 +0000
162@@ -30,7 +30,9 @@
163 property color foregroundColor
164
165 /*!
166+ \deprecated
167 The color of disabled action buttons in the header.
168+ Replaced by buttons.disabledForegroundColor.
169 */
170 property color disabledForegroundColor
171
172@@ -45,6 +47,11 @@
173 property color backgroundColor
174
175 /*!
176+ Configuration of the colors of the action buttons in the header.
177+ */
178+ readonly property ActionItemProperties buttons: ActionItemProperties { }
179+
180+ /*!
181 The color of the divider at the bottom of the header.
182 */
183 property color dividerColor
184
185=== modified file 'src/Ubuntu/Components/Styles/Styles.pro'
186--- src/Ubuntu/Components/Styles/Styles.pro 2016-06-23 09:13:51 +0000
187+++ src/Ubuntu/Components/Styles/Styles.pro 2016-07-19 11:27:28 +0000
188@@ -13,6 +13,7 @@
189 1.3/PageHeaderStyle.qml \
190 1.3/ToolbarStyle.qml \
191 1.3/SectionsStyle.qml \
192+ 1.3/ActionItemProperties.qml \
193
194 load(ubuntu_qml_plugin)
195
196
197=== modified file 'src/Ubuntu/Components/Styles/qmldir'
198--- src/Ubuntu/Components/Styles/qmldir 2016-06-23 09:13:51 +0000
199+++ src/Ubuntu/Components/Styles/qmldir 2016-07-19 11:27:28 +0000
200@@ -12,3 +12,4 @@
201 PageHeaderStyle 1.3 1.3/PageHeaderStyle.qml
202 ToolbarStyle 1.3 1.3/ToolbarStyle.qml
203 SectionsStyle 1.3 1.3/SectionsStyle.qml
204+ActionItemProperties 1.3 1.3/ActionItemProperties.qml
205
206=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml'
207--- src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-12-09 21:41:45 +0000
208+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2016-07-19 11:27:28 +0000
209@@ -1,5 +1,5 @@
210 /*
211- * Copyright 2015 Canonical Ltd.
212+ * Copyright 2016 Canonical Ltd.
213 *
214 * This program is free software; you can redistribute it and/or modify
215 * it under the terms of the GNU Lesser General Public License as published by
216@@ -28,19 +28,49 @@
217 // Unused with the standard action icon buttons, but may be used with a custom delegate.
218 overflowText: "More"
219
220+ backgroundColor: theme.palette.normal.background
221+ buttons {
222+ foregroundColor: theme.palette.normal.backgroundText
223+ pressedForegroundColor: buttons.foregroundColor
224+ disabledForegroundColor: theme.palette.disabled.backgroundText
225+ backgroundColor: "transparent" // action bar background is already colored
226+ pressedBackgroundColor: theme.palette.highlighted.background
227+ disabledBackgroundColor: buttons.backgroundColor
228+ }
229+
230 /*!
231 The default action delegate if the styled item does
232 not provide a delegate.
233 */
234- defaultDelegate: AbstractButton {
235- style: IconButtonStyle { }
236- objectName: action.objectName + "_button"
237- height: parent ? parent.height : undefined
238- action: modelData
239+ defaultDelegate: Component {
240+ AbstractButton {
241+ id: button
242+ style: IconButtonStyle {
243+ foregroundColor: button.pressed ?
244+ actionBarStyle.buttons.pressedForegroundColor :
245+ button.enabled ?
246+ actionBarStyle.buttons.foregroundColor :
247+ actionBarStyle.buttons.disabledForegroundColor
248+ backgroundColor: button.pressed ?
249+ actionBarStyle.buttons.pressedBackgroundColor :
250+ button.enabled ?
251+ actionBarStyle.buttons.backgroundColor :
252+ actionBarStyle.buttons.disabledBackgroundColor
253+ }
254+ objectName: action.objectName + "_button"
255+ height: parent ? parent.height : undefined
256+ action: modelData
257+ }
258 }
259
260 defaultNumberOfSlots: 3
261
262+ Rectangle {
263+ id: background
264+ anchors.fill: parent
265+ color: actionBarStyle.backgroundColor
266+ }
267+
268 Component {
269 id: fadeInComponent
270 SequentialAnimation {
271
272=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml'
273--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-06-14 14:37:54 +0000
274+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-07-19 11:27:28 +0000
275@@ -26,6 +26,14 @@
276 subtitleColor: theme.palette.normal.backgroundTertiaryText
277 backgroundColor: theme.palette.normal.background
278 dividerColor: theme.palette.normal.base
279+ buttons {
280+ foregroundColor: pageHeaderStyle.foregroundColor
281+ disabledForegroundColor: pageHeaderStyle.disabledForegroundColor
282+ pressedForegroundColor: buttons.foregroundColor
283+ backgroundColor: "transparent"
284+ pressedBackgroundColor: theme.palette.highlighted.background
285+ disabledBackgroundColor: buttons.backgroundColor
286+ }
287
288 // Font weight for the title and subtitle
289 property int fontWeight: Font.Light
290@@ -84,13 +92,22 @@
291 }
292
293 defaultActionDelegate: AbstractButton {
294+ id: button
295 style: IconButtonStyle { }
296 objectName: action.objectName + "_button"
297 height: internal.titleAreaHeight
298 action: modelData
299 StyleHints {
300- foregroundColor: enabled ? pageHeaderStyle.foregroundColor
301- : pageHeaderStyle.disabledForegroundColor
302+ foregroundColor: button.pressed ?
303+ pageHeaderStyle.buttons.pressedForegroundColor :
304+ button.enabled ?
305+ pageHeaderStyle.buttons.foregroundColor :
306+ pageHeaderStyle.buttons.disabledForegroundColor
307+ backgroundColor: button.pressed ?
308+ pageHeaderStyle.buttons.pressedBackgroundColor :
309+ button.enabled ?
310+ pageHeaderStyle.buttons.backgroundColor :
311+ pageHeaderStyle.buttons.disabledBackgroundColor
312 }
313 }
314
315
316=== modified file 'tests/unit/visual/tst_actionbar.13.qml'
317--- tests/unit/visual/tst_actionbar.13.qml 2016-06-15 13:46:51 +0000
318+++ tests/unit/visual/tst_actionbar.13.qml 2016-07-19 11:27:28 +0000
319@@ -1,5 +1,5 @@
320 /*
321- * Copyright 2015 Canonical Ltd.
322+ * Copyright 2016 Canonical Ltd.
323 *
324 * This program is free software; you can redistribute it and/or modify
325 * it under the terms of the GNU Lesser General Public License as published by
326@@ -15,38 +15,71 @@
327 */
328
329 import QtQuick 2.4
330+import QtQuick.Layouts 1.1
331 import Ubuntu.Test 1.0
332 import Ubuntu.Components 1.3
333
334 Item {
335 id: root
336- width: 400
337- height: 600
338+ width: units.gu(50)
339+ height: units.gu(60)
340
341 property list<Action> actionList: [
342 Action {
343 iconName: "alarm-clock"
344 text: "Tick tock"
345+ onTriggered: print("tock")
346 },
347 Action {
348 iconName: "appointment"
349 text: "Date"
350+ onTriggered: print("date")
351 },
352 Action {
353 iconName: "attachment"
354 text: "Attach"
355+ onTriggered: print("attach")
356 },
357 Action {
358 iconName: "contact"
359 text: "Contact"
360+ onTriggered: print("contact")
361 },
362 Action {
363 iconName: "like"
364 text: "Like"
365+ onTriggered: print("+1")
366 },
367 Action {
368 iconName: "lock"
369 text: "Lock"
370+ onTriggered: print("lock")
371+ },
372+ Action {
373+ iconName: "camcorder"
374+ text: "Camera"
375+ onTriggered: print("cam")
376+ },
377+ Action {
378+ iconName: "location"
379+ text: "Location"
380+ onTriggered: print("loc")
381+ enabled: false
382+ },
383+ Action {
384+ iconName: "message"
385+ text: "Message"
386+ onTriggered: print("msg")
387+ },
388+ Action {
389+ iconName: "livetv"
390+ text: "Television"
391+ onTriggered: print("tv")
392+ },
393+ Action {
394+ iconName: "lock-broken"
395+ text: "Unlock"
396+ onTriggered: print("unlock")
397 }
398 ]
399
400@@ -54,10 +87,12 @@
401 Action {
402 iconName: "share"
403 text: "Share"
404+ onTriggered: print("share")
405 },
406 Action {
407 iconName: "starred"
408 text: "Favorite"
409+ onTriggered: print("fav")
410 }
411 ]
412
413@@ -70,13 +105,12 @@
414 }
415 height: childrenRect.height
416
417- Item {
418+ RowLayout {
419 width: parent.width
420 height: childrenRect.height
421
422 Label {
423 anchors {
424- left: parent.left
425 verticalCenter: shortBar.verticalCenter
426 }
427 text: "" + shortBar.numberOfSlots + " slot(s):"
428@@ -85,18 +119,17 @@
429 ActionBar {
430 // no numberOfSlots specified. Using default value.
431 id: shortBar
432- anchors.right: parent.right
433+ Layout.fillWidth: true
434 actions: root.shortActionList
435 }
436 }
437
438- Item {
439+ RowLayout {
440 width: parent.width
441 height: childrenRect.height
442
443 Label {
444 anchors {
445- left: parent.left
446 verticalCenter: bar.verticalCenter
447 }
448 text: "" + bar.numberOfSlots + " slot(s):"
449@@ -104,9 +137,36 @@
450
451 ActionBar {
452 id: bar
453- anchors.right: parent.right
454- numberOfSlots: numberOfActionsSlider.value.toFixed(0)
455- actions: root.actionList
456+ Layout.fillWidth: true
457+ numberOfSlots: numberOfActionsSlider.value.toFixed(0)
458+ actions: root.actionList
459+ }
460+ }
461+
462+ RowLayout {
463+ width: parent.width
464+ height: childrenRect.height
465+ Label {
466+ anchors {
467+ verticalCenter: coloredBar.verticalCenter
468+ }
469+ text: "colored:"
470+ }
471+ ActionBar {
472+ id: coloredBar
473+ Layout.fillWidth: true
474+ numberOfSlots: numberOfActionsSlider.value.toFixed(0)
475+ actions: root.actionList
476+ StyleHints {
477+ ignoreUnknownProperties: false
478+ backgroundColor: UbuntuColors.blue
479+ buttons {
480+ foregroundColor: "white"
481+ disabledForegroundColor: UbuntuColors.silk
482+ pressedBackgroundColor: UbuntuColors.ash
483+ disabledBackgroundColor: UbuntuColors.slate
484+ }
485+ }
486 }
487 }
488
489@@ -122,20 +182,19 @@
490 live: true
491 }
492
493- Item {
494+ RowLayout {
495 width: parent.width
496 height: childrenRect.height
497
498 Label {
499 anchors {
500- left: parent.left
501 verticalCenter: customDelegateBar.verticalCenter
502 }
503 text: "Custom delegate"
504 }
505 ActionBar {
506 id: customDelegateBar
507- anchors.right: parent.right
508+ Layout.fillWidth: true
509 actions: root.shortActionList
510 delegate: Button {
511 action: modelData
512@@ -146,23 +205,25 @@
513 }
514 }
515
516- Item {
517+ RowLayout {
518 width: parent.width
519 height: childrenRect.height
520 Label {
521 anchors {
522- left: parent.left
523 verticalCenter: greenButtonsBar.verticalCenter
524 }
525 text: "Custom delegate 2"
526 }
527 ActionBar {
528+ // Note: The same result (green buttons) can be accomplished
529+ // by setting the foregroundColor in the style.
530 id: greenButtonsBar
531- anchors.right: parent.right
532+ Layout.fillWidth: true
533 actions: root.actionList
534 delegate: AbstractButton {
535 styleName: "IconButtonStyle"
536 action: modelData
537+ height: greenButtonsBar.height
538 StyleHints {
539 foregroundColor: UbuntuColors.green
540 }
541
542=== modified file 'tests/unit/visual/tst_pageheader.13.qml'
543--- tests/unit/visual/tst_pageheader.13.qml 2016-06-15 13:46:51 +0000
544+++ tests/unit/visual/tst_pageheader.13.qml 2016-07-19 11:27:28 +0000
545@@ -1,5 +1,5 @@
546 /*
547- * Copyright (C) 2015 Canonical Ltd.
548+ * Copyright (C) 2016 Canonical Ltd.
549 *
550 * This program is free software; you can redistribute it and/or modify
551 * it under the terms of the GNU Lesser General Public License as published by
552@@ -139,6 +139,28 @@
553 navigationActions: leadingActionsSwitch.checked ?
554 root.actionList : []
555 extension: extensionSwitch.checked ? appendix : null
556+
557+ StyleHints {
558+ ignoreUnknownProperties: false
559+ foregroundColor: customColorsSwitch.checked
560+ ? "white"
561+ : theme.palette.normal.backgroundText
562+ buttons.disabledForegroundColor: customColorsSwitch.checked
563+ ? "black"
564+ : theme.palette.disabled.backgroundText
565+ subtitleColor: customColorsSwitch.checked
566+ ? UbuntuColors.red
567+ : theme.palette.normal.backgroundTertiaryText
568+ backgroundColor: customColorsSwitch.checked
569+ ? UbuntuColors.blue
570+ : theme.palette.normal.background
571+ buttons.pressedBackgroundColor: customColorsSwitch.checked
572+ ? UbuntuColors.green
573+ : theme.palette.highlighted.background
574+ dividerColor: customColorsSwitch.checked
575+ ? UbuntuColors.red
576+ : theme.palette.normal.base
577+ }
578 }
579
580 Flickable {
581@@ -244,6 +266,14 @@
582 Label {
583 text: "subtitle"
584 }
585+
586+ Switch {
587+ id: customColorsSwitch
588+ checked: false
589+ }
590+ Label {
591+ text: "custom colors"
592+ }
593 }
594
595 PageHeader {

Subscribers

People subscribed via source and target branches