on xenial help sign in
Add support for header divider color and navigation background in ScopeStyle.qml
4726493Michał Sawicz
plugins/Dash/ScopeStyle.qml+6
@@ -83,6 +83,12 @@ QtObject {
83 /// Foreground color for the header
83 /// Foreground color for the header
84 readonly property color headerForeground: "foreground-color" in d.headerStyle ? d.headerStyle["foreground-color"] : foreground
84 readonly property color headerForeground: "foreground-color" in d.headerStyle ? d.headerStyle["foreground-color"] : foreground
85
85
86+ /// Color of the header divider
87+ readonly property color headerDividerColor: "divider-color" in d.headerStyle ? d.headerStyle["divider-color"] : "#e0e0e0"
88+
89+ /// Background style for the navigation
90+ readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#e0e0e0"
91+
86 //! @cond
92 //! @cond
87 property var d: QtObject {
93 property var d: QtObject {
88 // FIXME: should be taken from the theme
94 // FIXME: should be taken from the theme
tests/plugins/Dash/tst_ScopeStyle.qml+31−2
@@ -36,8 +36,12 @@ Rectangle {
36 property var styles: [
36 property var styles: [
37 {},
37 {},
38 { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" } },
38 { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" } },
39− { "foreground-color": "green", "background-color": "white", "page-header": { "foreground-color": "black" } },
39+ { "foreground-color": "green", "background-color": "white",
40+ "page-header": { "foreground-color": "black",
41+ "divider-color": "blue" } },
40− { "foreground-color": "blue", "background-color": "darkgrey", "page-header": { "background": "gradient:///white/blue" } },
42+ { "foreground-color": "blue", "background-color": "darkgrey",
43+ "page-header": { "background": "gradient:///white/blue",
44+ "navigation-background": "gradient:///white/blue" } },
41 ]
45 ]
42
46
43 function cleanup() {
47 function cleanup() {
@@ -179,5 +183,30 @@ Rectangle {
179 tool.style = testCase.styles[data.index];
183 tool.style = testCase.styles[data.index];
180 compare(tool.headerBackground, data.headerBackground, "Header background was incorrect.");
184 compare(tool.headerBackground, data.headerBackground, "Header background was incorrect.");
181 }
185 }
186+
187+ function test_headerDividerColor_data() {
188+ return [
189+ { tag: "default", index: 0, headerDividerColor: "#e0e0e0" },
190+ { tag: "blue", index: 2, headerDividerColor: "blue" },
191+ ];
192+ }
193+
194+ function test_headerDividerColor(data) {
195+ tool.style = testCase.styles[data.index];
196+ verify(Qt.colorEqual(tool.headerDividerColor, data.headerDividerColor),
197+ "Header divider color not equal: %1 != %2".arg(tool.headerDividerColor).arg(data.headerDividerColor));
198+ }
199+
200+ function test_navigationBackground_data() {
201+ return [
202+ { tag: "default", index: 0, navigationBackground: "color:///#e0e0e0" },
203+ { tag: "black", index: 3, navigationBackground: "gradient:///white/blue" },
204+ ];
205+ }
206+
207+ function test_navigationBackground(data) {
208+ tool.style = testCase.styles[data.index];
209+ compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
210+ }
182 }
211 }
183}
212}