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

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/ActionBar-colors
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 642 lines (+272/-26)
16 files modified
components.api (+5/-0)
src/Ubuntu/Components/1.3/PageHeader.qml (+6/-0)
src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml (+23/-1)
src/Ubuntu/Components/Styles/1.3/IconButtonProperties.qml (+10/-0)
src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml (+5/-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 (+30/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+9/-2)
src/Ubuntu/UbuntuToolkit/ucstylehints.cpp (+6/-3)
tests/unit/subtheming/GroupPropertyValueHints.qml (+33/-0)
tests/unit/subtheming/StyleHintsInvalidGroupedProperty.qml (+30/-0)
tests/unit/subtheming/subtheming.pro (+2/-0)
tests/unit/subtheming/tst_subtheming.cpp (+7/-1)
tests/unit/visual/tst_actionbar.13.qml (+75/-17)
tests/unit/visual/tst_pageheader.13.qml (+29/-0)
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 Needs Fixing
Cris Dywan Needs Information
Review via email: mp+299052@code.launchpad.net

This proposal has been superseded by a proposal from 2016-07-14.

Commit message

Configure ActionBar colors through its Style.

Added the following properties to ActionBarStyle:
- foregroundColor
- disabledForegroundColor (for icons with action.enabled == false)
- backgroundColor (background color of the full ActionBar)
- pressedBackgroundColor (background color of the button when pressed)

Also added the following missing property to the existing color properties in PageHeaderStyle:
- pressedBackgroundColor

Description of the change

Added the following properties to ActionBarStyle:
- foregroundColor
- disabledForegroundColor (for icons with action.enabled == false)
- backgroundColor (background color of the full ActionBar)
- pressedBackgroundColor (background color of the button when pressed)

Also added the following missing property to PageHeaderStyle:
- pressedBackgroundColor

The other properties were already available in PageHeaderStyle.

It was already possible to control the icon colors somewhat by overriding the default delegate for the icon buttons in the ActionBar, 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.
2033. By Tim Peeters

update components.api

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2034. By Tim Peeters

clean

2035. By Tim Peeters

clean

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: 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: 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: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> - 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
2036. By Tim Peeters

rename pressedBackgroundColor property to pressedButtonBackgroundColor

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

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.

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: 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: Needs Fixing (continuous-integration)
2037. By Tim Peeters

fix anchor

2038. By Tim Peeters

sync staging

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: 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: Needs Fixing (continuous-integration)
2039. By Tim Peeters

sync staging

2040. By Tim Peeters

test grouped property

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

clean

2042. By Tim Peeters

sync fixGroupedStyleProperties

2043. By Tim Peeters

buttons color properties

2044. By Tim Peeters

update components.api

2045. By Tim Peeters

clean test; make delegate a proper Component

2046. By Tim Peeters

rename IconButtonProperties to ButtonProperties

2047. By Tim Peeters

document and clean

2048. By Tim Peeters

add ButtonProperties to PageHeaderStyle

2049. By Tim Peeters

rename ButtonProperties to ActionItemProperties

2050. By Tim Peeters

update components.api

2051. By Tim Peeters

fix coloring of ActionBars in PageHeader

2052. By Tim Peeters

sync fixGroupedStyleProperties

2053. By Tim Peeters

sync staging

2054. By Tim Peeters

use older QtQuick.Layouts in actionbar unit test

Unmerged revisions

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

Subscribers

People subscribed via source and target branches