on xenial help sign in
Add unit tests.
22f804fYing-Chun Liu
qml/Dash/GenericScopeView.qml+5−4
@@ -59,7 +59,7 @@ FocusScope {
59 subPageLoader.closeSubPage()
59 subPageLoader.closeSubPage()
60 }
60 }
61
61
62− function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
62+ function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount, cardTool) {
63 if (cardTool.template && cardTool.template["non-interactive"]) {
63 if (cardTool.template && cardTool.template["non-interactive"]) {
64 return;
64 return;
65 }
65 }
@@ -73,7 +73,7 @@ FocusScope {
73 }
73 }
74 }
74 }
75
75
76− function itemPressedAndHeld(index, itemModel, resultsModel, limitedCategoryItemCount) {
76+ function itemPressedAndHeld(index, itemModel, resultsModel, limitedCategoryItemCount, cardTool) {
77 if (cardTool.template && cardTool.template["non-interactive"]) {
77 if (cardTool.template && cardTool.template["non-interactive"]) {
78 return;
78 return;
79 }
79 }
@@ -211,6 +211,7 @@ FocusScope {
211
211
212 Loader {
212 Loader {
213 id: rendererLoader
213 id: rendererLoader
214+ objectName: "rendererLoader"
214 anchors {
215 anchors {
215 top: parent.top
216 top: parent.top
216 left: parent.left
217 left: parent.left
@@ -272,11 +273,11 @@ FocusScope {
272 Connections {
273 Connections {
273 target: rendererLoader.item
274 target: rendererLoader.item
274 onClicked: {
275 onClicked: {
275− scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount());
276+ scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount(), rendererLoader.item.cardTool);
276 }
277 }
277
278
278 onPressAndHold: {
279 onPressAndHold: {
279− scopeView.itemPressedAndHeld(index, itemModel, target.model, categoryItemCount());
280+ scopeView.itemPressedAndHeld(index, itemModel, target.model, categoryItemCount(), rendererLoader.item.cardTool);
280 }
281 }
281
282
282 function categoryItemCount() {
283 function categoryItemCount() {
tests/plugins/Dash/cardcreator/1.res+23−18
@@ -33,15 +33,15 @@ Item {
33 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
38 function updateWidthHeightBindings() {
38 function updateWidthHeightBindings() {
39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
40 width = root.fixedArtShapeSize.width;
40 width = root.fixedArtShapeSize.width;
41 height = root.fixedArtShapeSize.height;
41 height = root.fixedArtShapeSize.height;
42 } else {
42 } else {
43− width = Qt.binding(function() { return !visible ? 0 : image.width });
43+ width = Qt.binding(function() { return !visible ? 0 : image.width });
44− height = Qt.binding(function() { return !visible ? 0 : image.height });
44+ height = Qt.binding(function() { return !visible ? 0 : image.height });
45 }
45 }
46 }
46 }
47 image: Image {
47 image: Image {
@@ -49,7 +49,7 @@ Item {
49 source: cardData && cardData["art"] || "";
49 source: cardData && cardData["art"] || "";
50 cache: true;
50 cache: true;
51 asynchronous: root.asynchronous;
51 asynchronous: root.asynchronous;
52− fillMode: Image.PreserveAspectCrop;
52+ fillMode: Image.PreserveAspectCrop;
53 width: root.width;
53 width: root.width;
54 height: width / artShape.aspect;
54 height: width / artShape.aspect;
55 }
55 }
@@ -60,29 +60,34 @@ readonly property int headerHeight: titleLabel.height;
60Label {
60Label {
61 id: titleLabel;
61 id: titleLabel;
62 objectName: "titleLabel";
62 objectName: "titleLabel";
63− anchors { right: parent.right;
63+ anchors { right: parent.right;
64− left: parent.left;
64+left: parent.left;
65− top: artShapeHolder.bottom;
65+top: artShapeHolder.bottom;
66− topMargin: units.gu(1);
66+ topMargin: units.gu(1);
67− }
67+ }
68 elide: Text.ElideRight;
68 elide: Text.ElideRight;
69 fontSize: "small";
69 fontSize: "small";
70 wrapMode: Text.Wrap;
70 wrapMode: Text.Wrap;
71 maximumLineCount: 2;
71 maximumLineCount: 2;
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
73+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
74 visible: showHeader ;
74 visible: showHeader ;
75 text: root.title;
75 text: root.title;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
77 horizontalAlignment: root.headerAlignment;
77 horizontalAlignment: root.headerAlignment;
78 }
78 }
79−UbuntuShape {
79+UbuntuShape {
80− id: touchdown;
80+ id: touchdown;
81− objectName: "touchdown";
81+ objectName: "touchdown";
82− anchors { fill: artShapeHolder }
82+ anchors { fill: artShapeHolder }
83+ visible: {
84+ if (root.template && root.template["non-interactive"]) {
85+ return false;
86+ }
83− visible: root.pressed;
87+ return root.pressed;
88+ }
84− radius: "medium";
89+ radius: "medium";
85− borderSource: "radius_pressed.sci"
90+ borderSource: "radius_pressed.sci"
86−}
91+ }
87implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
92implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
88}
93}
tests/plugins/Dash/cardcreator/2.res+34−29
@@ -55,19 +55,19 @@ Row {
55 spacing: margins;
55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top;
57 anchors { top: parent.top;
58− topMargin: units.gu(1);
58+ topMargin: units.gu(1);
59− left: parent.left;
59+left: parent.left;
60− }
60+ }
61 anchors.right: parent.right;
61 anchors.right: parent.right;
62− anchors.margins: margins;
62+ anchors.margins: margins;
63− anchors.rightMargin: 0;
63+ anchors.rightMargin: 0;
64− data: [
64+ data: [
65−Image {
65+ Image {
66 id: mascotImage;
66 id: mascotImage;
67 objectName: "mascotImage";
67 objectName: "mascotImage";
68 anchors { verticalCenter: parent.verticalCenter; }
68 anchors { verticalCenter: parent.verticalCenter; }
69 readonly property int maxSize: Math.max(width, height) * 4;
69 readonly property int maxSize: Math.max(width, height) * 4;
70− source: cardData && cardData["mascot"] || "";
70+ source: cardData && cardData["mascot"] || "";
71 width: units.gu(6);
71 width: units.gu(6);
72 height: units.gu(5.625);
72 height: units.gu(5.625);
73 sourceSize { width: maxSize; height: maxSize }
73 sourceSize { width: maxSize; height: maxSize }
@@ -85,52 +85,57 @@ Image {
85 Label {
85 Label {
86 id: titleLabel;
86 id: titleLabel;
87 objectName: "titleLabel";
87 objectName: "titleLabel";
88− anchors { right: parent.right;
88+ anchors { right: parent.right;
89− rightMargin: units.gu(1);
89+rightMargin: units.gu(1);
90− left: parent.left;
90+left: parent.left;
91− top: parent.top; }
91+ top: parent.top; }
92 elide: Text.ElideRight;
92 elide: Text.ElideRight;
93 fontSize: "small";
93 fontSize: "small";
94 wrapMode: Text.Wrap;
94 wrapMode: Text.Wrap;
95 maximumLineCount: 2;
95 maximumLineCount: 2;
96 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
96 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
97− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
97+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
98 visible: showHeader ;
98 visible: showHeader ;
99 text: root.title;
99 text: root.title;
100 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
100 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
101 horizontalAlignment: root.headerAlignment;
101 horizontalAlignment: root.headerAlignment;
102 }
102 }
103− ,Label {
103+,Label {
104 id: subtitleLabel;
104 id: subtitleLabel;
105 objectName: "subtitleLabel";
105 objectName: "subtitleLabel";
106− anchors { right: parent.right;
106+ anchors { right: parent.right;
107− left: parent.left;
107+ left: parent.left;
108− rightMargin: units.gu(1);
108+rightMargin: units.gu(1);
109− top: titleLabel.bottom;
109+top: titleLabel.bottom;
110− }
110+ }
111 anchors.topMargin: units.dp(2);
111 anchors.topMargin: units.dp(2);
112 elide: Text.ElideRight;
112 elide: Text.ElideRight;
113 fontSize: "small";
113 fontSize: "small";
114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
115− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
115+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
116 visible: titleLabel.visible && titleLabel.text;
116 visible: titleLabel.visible && titleLabel.text;
117 text: cardData && cardData["subtitle"] || "";
117 text: cardData && cardData["subtitle"] || "";
118 font.weight: Font.Light;
118 font.weight: Font.Light;
119 horizontalAlignment: root.headerAlignment;
119 horizontalAlignment: root.headerAlignment;
120 }
120 }
121
121
122− ]
122+ ]
123 }
123 }
124
124
125 ]
125 ]
126 }
126 }
127−UbuntuShape {
127+UbuntuShape {
128− id: touchdown;
128+ id: touchdown;
129− objectName: "touchdown";
129+ objectName: "touchdown";
130− anchors { fill: backgroundLoader }
130+ anchors { fill: backgroundLoader }
131+ visible: {
132+ if (root.template && root.template["non-interactive"]) {
133+ return false;
134+ }
131− visible: root.pressed;
135+ return root.pressed;
136+ }
132− radius: "medium";
137+ radius: "medium";
133− borderSource: "radius_pressed.sci"
138+ borderSource: "radius_pressed.sci"
134−}
139+ }
135implicitHeight: row.y + row.height + units.gu(1);
140implicitHeight: row.y + row.height + units.gu(1);
136}
141}
tests/plugins/Dash/cardcreator/3.res+29−24
@@ -25,7 +25,7 @@ Item {
25 objectName: "artShapeLoader";
25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false;
26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous;
27 asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
28+ visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape {
29 sourceComponent: UbuntuShape {
30 id: artShape;
30 id: artShape;
31 objectName: "artShape";
31 objectName: "artShape";
@@ -40,8 +40,8 @@ Item {
40 width = root.fixedArtShapeSize.width;
40 width = root.fixedArtShapeSize.width;
41 height = root.fixedArtShapeSize.height;
41 height = root.fixedArtShapeSize.height;
42 } else {
42 } else {
43− width = Qt.binding(function() { return !visible ? 0 : image.width });
43+ width = Qt.binding(function() { return !visible ? 0 : image.width });
44− height = Qt.binding(function() { return !visible ? 0 : image.height });
44+ height = Qt.binding(function() { return !visible ? 0 : image.height });
45 }
45 }
46 }
46 }
47 image: Image {
47 image: Image {
@@ -49,7 +49,7 @@ Item {
49 source: cardData && cardData["art"] || "";
49 source: cardData && cardData["art"] || "";
50 cache: true;
50 cache: true;
51 asynchronous: root.asynchronous;
51 asynchronous: root.asynchronous;
52− fillMode: Image.PreserveAspectCrop;
52+ fillMode: Image.PreserveAspectCrop;
53 width: root.width;
53 width: root.width;
54 height: width / artShape.aspect;
54 height: width / artShape.aspect;
55 }
55 }
@@ -60,17 +60,17 @@ readonly property int headerHeight: titleLabel.height + subtitleLabel.height + s
60Label {
60Label {
61 id: titleLabel;
61 id: titleLabel;
62 objectName: "titleLabel";
62 objectName: "titleLabel";
63− anchors { right: parent.right;
63+ anchors { right: parent.right;
64− left: parent.left;
64+left: parent.left;
65− top: artShapeHolder.bottom;
65+top: artShapeHolder.bottom;
66− topMargin: units.gu(1);
66+ topMargin: units.gu(1);
67− }
67+ }
68 elide: Text.ElideRight;
68 elide: Text.ElideRight;
69 fontSize: "small";
69 fontSize: "small";
70 wrapMode: Text.Wrap;
70 wrapMode: Text.Wrap;
71 maximumLineCount: 2;
71 maximumLineCount: 2;
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
73+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
74 visible: showHeader ;
74 visible: showHeader ;
75 text: root.title;
75 text: root.title;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -80,27 +80,32 @@ Label {
80 id: subtitleLabel;
80 id: subtitleLabel;
81 objectName: "subtitleLabel";
81 objectName: "subtitleLabel";
82 anchors { left: titleLabel.left;
82 anchors { left: titleLabel.left;
83− leftMargin: titleLabel.leftMargin;
83+ leftMargin: titleLabel.leftMargin;
84− right: titleLabel.right;
84+right: titleLabel.right;
85− top: titleLabel.bottom;
85+top: titleLabel.bottom;
86− }
86+ }
87− anchors.topMargin: units.dp(2);
87+ anchors.topMargin: units.dp(2);
88 elide: Text.ElideRight;
88 elide: Text.ElideRight;
89 fontSize: "small";
89 fontSize: "small";
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
91+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
92 visible: titleLabel.visible && titleLabel.text;
92 visible: titleLabel.visible && titleLabel.text;
93 text: cardData && cardData["subtitle"] || "";
93 text: cardData && cardData["subtitle"] || "";
94 font.weight: Font.Light;
94 font.weight: Font.Light;
95 horizontalAlignment: root.headerAlignment;
95 horizontalAlignment: root.headerAlignment;
96 }
96 }
97−UbuntuShape {
97+UbuntuShape {
98− id: touchdown;
98+ id: touchdown;
99− objectName: "touchdown";
99+ objectName: "touchdown";
100− anchors { fill: artShapeHolder }
100+ anchors { fill: artShapeHolder }
101+ visible: {
102+ if (root.template && root.template["non-interactive"]) {
103+ return false;
104+ }
101− visible: root.pressed;
105+ return root.pressed;
106+ }
102− radius: "medium";
107+ radius: "medium";
103− borderSource: "radius_pressed.sci"
108+ borderSource: "radius_pressed.sci"
104−}
109+ }
105implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
110implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
106}
111}
tests/plugins/Dash/cardcreator/4.res+87−82
@@ -5,8 +5,8 @@ AbstractButton {
5 property var cardData;
5 property var cardData;
6 property var artShapeBorderSource: undefined;
6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8− property var scopeStyle: null;
8+ property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
9+ property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1;
10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1);
11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || "";
12 readonly property string title: cardData && cardData["title"] || "";
@@ -16,99 +16,104 @@ AbstractButton {
16readonly property size artShapeSize: Qt.size(-1, -1);
16readonly property size artShapeSize: Qt.size(-1, -1);
17readonly property int headerHeight: row.height;
17readonly property int headerHeight: row.height;
18Row {
18Row {
19− id: row;
19+ id: row;
20− objectName: "outerRow";
20+ objectName: "outerRow";
21− property real margins: units.gu(1);
21+ property real margins: units.gu(1);
22− spacing: margins;
22+ spacing: margins;
23− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
23+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
24− anchors { top: parent.top;
24+ anchors { top: parent.top;
25 topMargin: units.gu(1);
25 topMargin: units.gu(1);
26− left: parent.left;
26+left: parent.left;
27−}
27+ }
28− anchors.right: parent.right;
28+ anchors.right: parent.right;
29− anchors.margins: margins;
29+ anchors.margins: margins;
30− anchors.rightMargin: 0;
30+ anchors.rightMargin: 0;
31−data: [
31+ data: [
32−Loader {
32+ Loader {
33− id: mascotShapeLoader;
33+ id: mascotShapeLoader;
34− objectName: "mascotShapeLoader";
34+ objectName: "mascotShapeLoader";
35− asynchronous: root.asynchronous;
35+ asynchronous: root.asynchronous;
36− active: mascotImage.status === Image.Ready;
36+ active: mascotImage.status === Image.Ready;
37− visible: showHeader && active && status == Loader.Ready;
37+ visible: showHeader && active && status == Loader.Ready;
38− width: units.gu(6);
38+ width: units.gu(6);
39− height: units.gu(5.625);
39+ height: units.gu(5.625);
40− sourceComponent: UbuntuShape { image: mascotImage }
40+ sourceComponent: UbuntuShape { image: mascotImage }
41− anchors { verticalCenter: parent.verticalCenter; }
41+ anchors { verticalCenter: parent.verticalCenter; }
42− }
42+ }
43−
44,Image {
43,Image {
45− id: mascotImage;
44+ id: mascotImage;
46− objectName: "mascotImage";
45+ objectName: "mascotImage";
47− anchors { verticalCenter: parent.verticalCenter; }
46+ anchors { verticalCenter: parent.verticalCenter; }
48− readonly property int maxSize: Math.max(width, height) * 4;
47+ readonly property int maxSize: Math.max(width, height) * 4;
49− source: cardData && cardData["mascot"] || "";
48+ source: cardData && cardData["mascot"] || "";
50− width: units.gu(6);
49+ width: units.gu(6);
51− height: units.gu(5.625);
50+ height: units.gu(5.625);
52− sourceSize { width: maxSize; height: maxSize }
51+ sourceSize { width: maxSize; height: maxSize }
53− fillMode: Image.PreserveAspectCrop;
52+ fillMode: Image.PreserveAspectCrop;
54− horizontalAlignment: Image.AlignHCenter;
53+ horizontalAlignment: Image.AlignHCenter;
55− verticalAlignment: Image.AlignVCenter;
54+ verticalAlignment: Image.AlignVCenter;
56− visible: false;
55+ visible: false;
57− }
56+ }
58−
59,Item {
57,Item {
60 id: headerTitleContainer;
58 id: headerTitleContainer;
61 anchors { verticalCenter: parent.verticalCenter; }
59 anchors { verticalCenter: parent.verticalCenter; }
62 width: parent.width - x;
60 width: parent.width - x;
63 implicitHeight: titleLabel.height + subtitleLabel.height;
61 implicitHeight: titleLabel.height + subtitleLabel.height;
64 data: [
62 data: [
65−Label {
63+ Label {
66− id: titleLabel;
64+ id: titleLabel;
67− objectName: "titleLabel";
65+ objectName: "titleLabel";
68− anchors { right: parent.right;
69− rightMargin: units.gu(1);
70− left: parent.left;
71− top: parent.top; }
72− elide: Text.ElideRight;
73− fontSize: "small";
74− wrapMode: Text.Wrap;
75− maximumLineCount: 2;
76− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
77− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
78− visible: showHeader ;
79− text: root.title;
80− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
81− horizontalAlignment: root.headerAlignment;
82− }
83−,Label {
84− id: subtitleLabel;
85− objectName: "subtitleLabel";
86 anchors { right: parent.right;
66 anchors { right: parent.right;
87− left: parent.left;
88− rightMargin: units.gu(1);
67+rightMargin: units.gu(1);
89− top: titleLabel.bottom;
68+left: parent.left;
90− }
69+ top: parent.top; }
91− anchors.topMargin: units.dp(2);
92 elide: Text.ElideRight;
70 elide: Text.ElideRight;
93 fontSize: "small";
71 fontSize: "small";
72+ wrapMode: Text.Wrap;
73+ maximumLineCount: 2;
94 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
74 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
95− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
75+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
96− visible: titleLabel.visible && titleLabel.text;
76+ visible: showHeader ;
97− text: cardData && cardData["subtitle"] || "";
77+ text: root.title;
98− font.weight: Font.Light;
78+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
99 horizontalAlignment: root.headerAlignment;
79 horizontalAlignment: root.headerAlignment;
100 }
80 }
101−]
81+,Label {
82+ id: subtitleLabel;
83+ objectName: "subtitleLabel";
84+ anchors { right: parent.right;
85+ left: parent.left;
86+rightMargin: units.gu(1);
87+top: titleLabel.bottom;
88+ }
89+ anchors.topMargin: units.dp(2);
90+ elide: Text.ElideRight;
91+ fontSize: "small";
92+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
93+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
94+ visible: titleLabel.visible && titleLabel.text;
95+ text: cardData && cardData["subtitle"] || "";
96+ font.weight: Font.Light;
97+ horizontalAlignment: root.headerAlignment;
98+ }
99+
100+ ]
102−}
101+ }
102+
103−]
103+ ]
104−}
104+ }
105−UbuntuShape {
105+UbuntuShape {
106− id: touchdown;
106+ id: touchdown;
107− objectName: "touchdown";
107+ objectName: "touchdown";
108− anchors { fill: root }
108+ anchors { fill: root }
109+ visible: {
110+ if (root.template && root.template["non-interactive"]) {
111+ return false;
112+ }
109− visible: root.pressed;
113+ return root.pressed;
114+ }
110− radius: "medium";
115+ radius: "medium";
111− borderSource: "radius_pressed.sci"
116+ borderSource: "radius_pressed.sci"
112−}
117+ }
113implicitHeight: row.y + row.height + units.gu(1);
118implicitHeight: row.y + row.height + units.gu(1);
114}
119}
tests/plugins/Dash/cardcreator/5.res+36−31
@@ -25,7 +25,7 @@ Item {
25 objectName: "artShapeLoader";
25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false;
26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous;
27 asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
28+ visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape {
29 sourceComponent: UbuntuShape {
30 id: artShape;
30 id: artShape;
31 objectName: "artShape";
31 objectName: "artShape";
@@ -40,8 +40,8 @@ Item {
40 width = root.fixedArtShapeSize.width;
40 width = root.fixedArtShapeSize.width;
41 height = root.fixedArtShapeSize.height;
41 height = root.fixedArtShapeSize.height;
42 } else {
42 } else {
43− width = Qt.binding(function() { return !visible ? 0 : image.width });
43+ width = Qt.binding(function() { return !visible ? 0 : image.width });
44− height = Qt.binding(function() { return !visible ? 0 : image.height });
44+ height = Qt.binding(function() { return !visible ? 0 : image.height });
45 }
45 }
46 }
46 }
47 image: Image {
47 image: Image {
@@ -49,12 +49,12 @@ Item {
49 source: cardData && cardData["art"] || "";
49 source: cardData && cardData["art"] || "";
50 cache: true;
50 cache: true;
51 asynchronous: root.asynchronous;
51 asynchronous: root.asynchronous;
52− fillMode: Image.PreserveAspectCrop;
52+ fillMode: Image.PreserveAspectCrop;
53 width: root.width;
53 width: root.width;
54 height: width / artShape.aspect;
54 height: width / artShape.aspect;
55 }
55 }
56 }
56 }
57− }
57+ }
58 }
58 }
59Loader {
59Loader {
60 id: overlayLoader;
60 id: overlayLoader;
@@ -63,14 +63,14 @@ Loader {
63 right: artShapeHolder.right;
63 right: artShapeHolder.right;
64 bottom: artShapeHolder.bottom;
64 bottom: artShapeHolder.bottom;
65 }
65 }
66− active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
66+ active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
67 asynchronous: root.asynchronous;
67 asynchronous: root.asynchronous;
68 visible: showHeader && status == Loader.Ready;
68 visible: showHeader && status == Loader.Ready;
69 sourceComponent: ShaderEffect {
69 sourceComponent: ShaderEffect {
70 id: overlay;
70 id: overlay;
71− height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
71+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
72− property real luminance: Style.luminance(overlayColor);
72+ property real luminance: Style.luminance(overlayColor);
73− property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
73+ property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
74 property var source: ShaderEffectSource {
74 property var source: ShaderEffectSource {
75 id: shaderSource;
75 id: shaderSource;
76 sourceItem: artShapeLoader.item;
76 sourceItem: artShapeLoader.item;
@@ -91,7 +91,7 @@ Loader {
91 varying highp vec2 coord;
91 varying highp vec2 coord;
92 uniform sampler2D source;
92 uniform sampler2D source;
93 uniform lowp float qt_Opacity;
93 uniform lowp float qt_Opacity;
94− uniform highp vec4 overlayColor;
94+ uniform highp vec4 overlayColor;
95 void main() {
95 void main() {
96 lowp vec4 tex = texture2D(source, coord);
96 lowp vec4 tex = texture2D(source, coord);
97 gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a;
97 gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a;
@@ -100,21 +100,21 @@ Loader {
100 }
100 }
101readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
101readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
102Label {
102Label {
103− id: titleLabel;
103+ id: titleLabel;
104 objectName: "titleLabel";
104 objectName: "titleLabel";
105 anchors { right: parent.right;
105 anchors { right: parent.right;
106− rightMargin: units.gu(1);
106+rightMargin: units.gu(1);
107− left: parent.left;
107+left: parent.left;
108− leftMargin: units.gu(1);
108+ leftMargin: units.gu(1);
109− top: overlayLoader.top;
109+ top: overlayLoader.top;
110− topMargin: units.gu(1);
110+ topMargin: units.gu(1);
111− }
111+ }
112 elide: Text.ElideRight;
112 elide: Text.ElideRight;
113 fontSize: "small";
113 fontSize: "small";
114 wrapMode: Text.Wrap;
114 wrapMode: Text.Wrap;
115 maximumLineCount: 2;
115 maximumLineCount: 2;
116 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
116 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
117− color: root.scopeStyle ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
117+ color: root.scopeStyle ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
118 visible: showHeader && overlayLoader.active;
118 visible: showHeader && overlayLoader.active;
119 text: root.title;
119 text: root.title;
120 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
120 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -124,28 +124,33 @@ Label {
124 id: subtitleLabel;
124 id: subtitleLabel;
125 objectName: "subtitleLabel";
125 objectName: "subtitleLabel";
126 anchors { left: titleLabel.left;
126 anchors { left: titleLabel.left;
127− leftMargin: titleLabel.leftMargin;
127+ leftMargin: titleLabel.leftMargin;
128− rightMargin: units.gu(1);
128+rightMargin: units.gu(1);
129− right: titleLabel.right;
129+right: titleLabel.right;
130− top: titleLabel.bottom;
130+top: titleLabel.bottom;
131− }
131+ }
132 anchors.topMargin: units.dp(2);
132 anchors.topMargin: units.dp(2);
133 elide: Text.ElideRight;
133 elide: Text.ElideRight;
134 fontSize: "small";
134 fontSize: "small";
135 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
135 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
136− color: root.scopeStyle ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
136+ color: root.scopeStyle ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
137 visible: titleLabel.visible && titleLabel.text;
137 visible: titleLabel.visible && titleLabel.text;
138 text: cardData && cardData["subtitle"] || "";
138 text: cardData && cardData["subtitle"] || "";
139 font.weight: Font.Light;
139 font.weight: Font.Light;
140 horizontalAlignment: root.headerAlignment;
140 horizontalAlignment: root.headerAlignment;
141 }
141 }
142UbuntuShape {
142UbuntuShape {
143− id: touchdown;
143+ id: touchdown;
144− objectName: "touchdown";
144+ objectName: "touchdown";
145− anchors { fill: artShapeHolder }
145+ anchors { fill: artShapeHolder }
146+ visible: {
147+ if (root.template && root.template["non-interactive"]) {
148+ return false;
149+ }
146− visible: root.pressed;
150+ return root.pressed;
151+ }
147− radius: "medium";
152+ radius: "medium";
148− borderSource: "radius_pressed.sci"
153+ borderSource: "radius_pressed.sci"
149−}
154+ }
150implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
155implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
151}
156}
tests/plugins/Dash/cardcreator/6.res+46−40
@@ -1,18 +1,18 @@
1−AbstractButton {
1+AbstractButton {
2− id: root;
2+ id: root;
3− property var template;
3+ property var template;
4− property var components;
4+ property var components;
5− property var cardData;
5+ property var cardData;
6− property var artShapeBorderSource: undefined;
6+ property var artShapeBorderSource: undefined;
7− property real fontScale: 1.0;
7+ property real fontScale: 1.0;
8− property var scopeStyle: null;
8+ property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
9+ property int headerAlignment: Text.AlignLeft;
10− property int fixedHeaderHeight: -1;
10+ property int fixedHeaderHeight: -1;
11− property size fixedArtShapeSize: Qt.size(-1, -1);
11+ property size fixedArtShapeSize: Qt.size(-1, -1);
12− readonly property string title: cardData && cardData["title"] || "";
12+ readonly property string title: cardData && cardData["title"] || "";
13− property bool asynchronous: true;
13+ property bool asynchronous: true;
14− property bool showHeader: true;
14+ property bool showHeader: true;
15− implicitWidth: childrenRect.width;
15+ implicitWidth: childrenRect.width;
16Loader {
16Loader {
17 id: backgroundLoader;
17 id: backgroundLoader;
18 objectName: "backgroundLoader";
18 objectName: "backgroundLoader";
@@ -51,10 +51,10 @@ readonly property int headerHeight: titleLabel.height + subtitleLabel.height + s
51Item {
51Item {
52 id: headerTitleContainer;
52 id: headerTitleContainer;
53 anchors { right: parent.right; left: parent.left;
53 anchors { right: parent.right; left: parent.left;
54− top: parent.top;
54+top: parent.top;
55− topMargin: units.gu(1);
55+ topMargin: units.gu(1);
56− leftMargin: units.gu(1);
56+leftMargin: units.gu(1);
57− }
57+ }
58 width: parent.width - x;
58 width: parent.width - x;
59 implicitHeight: titleLabel.height + subtitleLabel.height;
59 implicitHeight: titleLabel.height + subtitleLabel.height;
60 data: [
60 data: [
@@ -62,15 +62,15 @@ Item {
62 id: titleLabel;
62 id: titleLabel;
63 objectName: "titleLabel";
63 objectName: "titleLabel";
64 anchors { right: emblemIcon.left;
64 anchors { right: emblemIcon.left;
65− rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0;
65+ rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0;
66− left: parent.left;
66+left: parent.left;
67− top: parent.top; }
67+ top: parent.top; }
68 elide: Text.ElideRight;
68 elide: Text.ElideRight;
69 fontSize: "small";
69 fontSize: "small";
70 wrapMode: Text.Wrap;
70 wrapMode: Text.Wrap;
71 maximumLineCount: 2;
71 maximumLineCount: 2;
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
73+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
74 visible: showHeader ;
74 visible: showHeader ;
75 text: root.title;
75 text: root.title;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -80,15 +80,15 @@ Item {
80 id: subtitleLabel;
80 id: subtitleLabel;
81 objectName: "subtitleLabel";
81 objectName: "subtitleLabel";
82 anchors { right: parent.right;
82 anchors { right: parent.right;
83− left: parent.left;
83+ left: parent.left;
84− rightMargin: units.gu(1);
84+rightMargin: units.gu(1);
85− top: titleLabel.bottom;
85+top: titleLabel.bottom;
86− }
86+ }
87 anchors.topMargin: units.dp(2);
87 anchors.topMargin: units.dp(2);
88 elide: Text.ElideRight;
88 elide: Text.ElideRight;
89 fontSize: "small";
89 fontSize: "small";
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
91+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
92 visible: titleLabel.visible && titleLabel.text;
92 visible: titleLabel.visible && titleLabel.text;
93 text: cardData && cardData["subtitle"] || "";
93 text: cardData && cardData["subtitle"] || "";
94 font.weight: Font.Light;
94 font.weight: Font.Light;
@@ -98,25 +98,31 @@ Item {
98 id: emblemIcon;
98 id: emblemIcon;
99 objectName: "emblemIcon";
99 objectName: "emblemIcon";
100 anchors {
100 anchors {
101− bottom: titleLabel.baseline;
101+ bottom: titleLabel.baseline;
102− right: parent.right;
102+ right: parent.right;
103− rightMargin: units.gu(1);
103+ rightMargin: units.gu(1);
104+
104 }
105 }
105 source: cardData && cardData["emblem"] || "";
106 source: cardData && cardData["emblem"] || "";
106− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
107+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
107 width: height;
108 width: height;
108 height: source != "" ? titleLabel.font.pixelSize : 0;
109 height: source != "" ? titleLabel.font.pixelSize : 0;
109 }
110 }
110
111
111 ]
112 ]
112 }
113 }
113−UbuntuShape {
114+UbuntuShape {
114− id: touchdown;
115+ id: touchdown;
115− objectName: "touchdown";
116+ objectName: "touchdown";
116− anchors { fill: backgroundLoader }
117+ anchors { fill: backgroundLoader }
118+ visible: {
119+ if (root.template && root.template["non-interactive"]) {
120+ return false;
121+ }
117− visible: root.pressed;
122+ return root.pressed;
123+ }
118− radius: "medium";
124+ radius: "medium";
119− borderSource: "radius_pressed.sci"
125+ borderSource: "radius_pressed.sci"
120−}
126+ }
121implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
127implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
122}
128}
tests/plugins/Dash/cardcreator/7.res+36−32
@@ -55,14 +55,14 @@ Row {
55 spacing: margins;
55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top;
57 anchors { top: parent.top;
58− topMargin: units.gu(1);
58+ topMargin: units.gu(1);
59− left: parent.left;
59+left: parent.left;
60− }
60+ }
61 anchors.right: parent.right;
61 anchors.right: parent.right;
62− anchors.margins: margins;
62+ anchors.margins: margins;
63− anchors.rightMargin: 0;
63+ anchors.rightMargin: 0;
64 data: [
64 data: [
65−Image {
65+ Image {
66 id: mascotImage;
66 id: mascotImage;
67 objectName: "mascotImage";
67 objectName: "mascotImage";
68 anchors { verticalCenter: parent.verticalCenter; }
68 anchors { verticalCenter: parent.verticalCenter; }
@@ -76,7 +76,6 @@ Image {
76 verticalAlignment: Image.AlignVCenter;
76 verticalAlignment: Image.AlignVCenter;
77 visible: showHeader;
77 visible: showHeader;
78 }
78 }
79−
80,Item {
79,Item {
81 id: headerTitleContainer;
80 id: headerTitleContainer;
82 anchors { verticalCenter: parent.verticalCenter; }
81 anchors { verticalCenter: parent.verticalCenter; }
@@ -87,15 +86,15 @@ Image {
87 id: titleLabel;
86 id: titleLabel;
88 objectName: "titleLabel";
87 objectName: "titleLabel";
89 anchors { right: parent.right;
88 anchors { right: parent.right;
90− rightMargin: units.gu(1);
89+rightMargin: units.gu(1);
91− left: parent.left;
90+left: parent.left;
92− top: parent.top; }
91+ top: parent.top; }
93 elide: Text.ElideRight;
92 elide: Text.ElideRight;
94 fontSize: "small";
93 fontSize: "small";
95 wrapMode: Text.Wrap;
94 wrapMode: Text.Wrap;
96 maximumLineCount: 2;
95 maximumLineCount: 2;
97 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
96 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
98− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
97+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
99 visible: showHeader ;
98 visible: showHeader ;
100 text: root.title;
99 text: root.title;
101 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
100 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -105,15 +104,15 @@ Image {
105 id: subtitleLabel;
104 id: subtitleLabel;
106 objectName: "subtitleLabel";
105 objectName: "subtitleLabel";
107 anchors { right: parent.right;
106 anchors { right: parent.right;
108− left: parent.left;
107+ left: parent.left;
109− rightMargin: units.gu(1);
108+rightMargin: units.gu(1);
110− top: titleLabel.bottom;
109+top: titleLabel.bottom;
111− }
110+ }
112 anchors.topMargin: units.dp(2);
111 anchors.topMargin: units.dp(2);
113 elide: Text.ElideRight;
112 elide: Text.ElideRight;
114 fontSize: "small";
113 fontSize: "small";
115 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
116− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
115+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
117 visible: titleLabel.visible && titleLabel.text;
116 visible: titleLabel.visible && titleLabel.text;
118 text: cardData && cardData["subtitle"] || "";
117 text: cardData && cardData["subtitle"] || "";
119 font.weight: Font.Light;
118 font.weight: Font.Light;
@@ -122,28 +121,33 @@ Image {
122,CardAttributes {
121,CardAttributes {
123 id: attributesRow;
122 id: attributesRow;
124 objectName: "attributesRow";
123 objectName: "attributesRow";
125− anchors { right: parent.right;
124+ anchors { right: parent.right;
126− left: parent.left;
125+ left: parent.left;
127− rightMargin: units.gu(1);
126+rightMargin: units.gu(1);
128− top: subtitleLabel.bottom;
127+top: subtitleLabel.bottom;
129− }
128+ }
130− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
129+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
131 fontScale: root.fontScale;
130 fontScale: root.fontScale;
132 model: cardData && cardData["attributes"];
131 model: cardData && cardData["attributes"];
133 }
132 }
134
133
135− ]
134+ ]
136− }
135+ }
137
136
138 ]
137 ]
139 }
138 }
140−UbuntuShape {
139+UbuntuShape {
141− id: touchdown;
140+ id: touchdown;
142− objectName: "touchdown";
141+ objectName: "touchdown";
143− anchors { fill: backgroundLoader }
142+ anchors { fill: backgroundLoader }
143+ visible: {
144+ if (root.template && root.template["non-interactive"]) {
145+ return false;
146+ }
144− visible: root.pressed;
147+ return root.pressed;
148+ }
145− radius: "medium";
149+ radius: "medium";
146− borderSource: "radius_pressed.sci"
150+ borderSource: "radius_pressed.sci"
147−}
151+ }
148implicitHeight: row.y + row.height + units.gu(1);
152implicitHeight: row.y + row.height + units.gu(1);
149}
153}
tests/qmltests/Dash/tst_GenericScopeView.qml+28
@@ -453,6 +453,34 @@ Item {
453
453
454 genericScopeView.scope = !genericScopeView.scope;
454 genericScopeView.scope = !genericScopeView.scope;
455 }
455 }
456+
457+ function test_item_noninteractive() {
458+ waitForRendering(genericScopeView);
459+
460+ var categoryListView = findChild(genericScopeView, "categoryListView");
461+ waitForRendering(categoryListView);
462+
463+ var category0 = findChild(categoryListView, "dashCategory0");
464+ waitForRendering(category0);
465+
466+ var cardTool = findChild(category0, "cardTool");
467+ var rendererLoader = findChild(category0, "rendererLoader");
468+ var cardGrid = rendererLoader.item;
469+
470+ cardTool.template["non-interactive"] = true;
471+ compare(cardGrid.cardTool.template["non-interactive"], true);
472+
473+ var item0 = findChild(cardGrid, "delegate0");
474+ waitForRendering(item0);
475+ var touchdown = findChild(item0, "touchdown");
476+
477+ compare(touchdown.visible, false);
478+ mouseClick(item0, item0.width / 2, item0.height / 2);
479+ compare(touchdown.visible, false);
480+
481+ cardTool.template["non-interactive"] = false;
482+ compare(cardGrid.cardTool.template["non-interactive"], false);
483+ }
456 }
484 }
457 }
485 }
458}
486}