on xenial help sign in
Do not use components in card creator generated code
73b509aAlbert Astals Cid
plugins/Dash/CardCreator.js+19−14
@@ -61,8 +61,10 @@ var kBackgroundLoaderCode = 'Loader {\n\
61// %1 is used as anchors of artShapeHolder
61// %1 is used as anchors of artShapeHolder
62// %2 is used as image width
62// %2 is used as image width
63// %3 is used as image height
63// %3 is used as image height
64+// %4 is used for artShapeSource.hideSource and inner Loader visible
65+// %5 is used as aspect ratio fallback
64−// %4 is injected as code to artImage
66+// %6 is injected as code to artImage
65−// %5 is used as image fallback
67+// %7 is used as image fallback
66var kArtShapeHolderCode = 'Item { \n\
68var kArtShapeHolderCode = 'Item { \n\
67 id: artShapeHolder; \n\
69 id: artShapeHolder; \n\
68 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
70 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -71,14 +73,13 @@ var kArtShapeHolderCode = 'Item { \n\
71 Loader { \n\
73 Loader { \n\
72 id: artShapeLoader; \n\
74 id: artShapeLoader; \n\
73 objectName: "artShapeLoader"; \n\
75 objectName: "artShapeLoader"; \n\
74− readonly property string cardArt: cardData && cardData["art"] || %5; \n\
76+ readonly property string cardArt: cardData && cardData["art"] || %7; \n\
75 active: cardArt != ""; \n\
77 active: cardArt != ""; \n\
76 asynchronous: root.asynchronous; \n\
78 asynchronous: root.asynchronous; \n\
77 visible: status == Loader.Ready; \n\
79 visible: status == Loader.Ready; \n\
78 sourceComponent: Item { \n\
80 sourceComponent: Item { \n\
79 id: artShape; \n\
81 id: artShape; \n\
80 objectName: "artShape"; \n\
82 objectName: "artShape"; \n\
81− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
82 visible: image.status == Image.Ready; \n\
83 visible: image.status == Image.Ready; \n\
83 readonly property alias image: artImage; \n\
84 readonly property alias image: artImage; \n\
84 ShaderEffectSource { \n\
85 ShaderEffectSource { \n\
@@ -87,11 +88,11 @@ var kArtShapeHolderCode = 'Item { \n\
87 anchors.centerIn: parent; \n\
88 anchors.centerIn: parent; \n\
88 width: 1; \n\
89 width: 1; \n\
89 height: 1; \n\
90 height: 1; \n\
90− hideSource: doShapeItem; \n\
91+ hideSource: %4; \n\
91 } \n\
92 } \n\
92 Loader { \n\
93 Loader { \n\
93 anchors.fill: parent; \n\
94 anchors.fill: parent; \n\
94− visible: artShape.doShapeItem; \n\
95+ visible: %4; \n\
95 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
96 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
96 Component { \n\
97 Component { \n\
97 id: artShapeShapeComponent; \n\
98 id: artShapeShapeComponent; \n\
@@ -115,7 +116,7 @@ var kArtShapeHolderCode = 'Item { \n\
115 } \n\
116 } \n\
116 } \n\
117 } \n\
117 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
118 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
118− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
119+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
119 Component.onCompleted: { updateWidthHeightBindings(); } \n\
120 Component.onCompleted: { updateWidthHeightBindings(); } \n\
120 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
121 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
121 function updateWidthHeightBindings() { \n\
122 function updateWidthHeightBindings() { \n\
@@ -134,7 +135,7 @@ var kArtShapeHolderCode = 'Item { \n\
134 asynchronous: root.asynchronous; \n\
135 asynchronous: root.asynchronous; \n\
135 width: %2; \n\
136 width: %2; \n\
136 height: %3; \n\
137 height: %3; \n\
137− %4 \n\
138+ %6 \n\
138 } \n\
139 } \n\
139 } \n\
140 } \n\
140 } \n\
141 } \n\
@@ -395,7 +396,6 @@ function cardString(template, components) {
395
396
396 code = 'AbstractButton { \n\
397 code = 'AbstractButton { \n\
397 id: root; \n\
398 id: root; \n\
398− property var components; \n\
399 property var cardData; \n\
399 property var cardData; \n\
400 property string artShapeStyle: "inset"; \n\
400 property string artShapeStyle: "inset"; \n\
401 property string backgroundShapeStyle: "inset"; \n\
401 property string backgroundShapeStyle: "inset"; \n\
@@ -413,7 +413,8 @@ function cardString(template, components) {
413
413
414 var hasArt = components["art"] && components["art"]["field"] || false;
414 var hasArt = components["art"] && components["art"]["field"] || false;
415 var hasSummary = components["summary"] || false;
415 var hasSummary = components["summary"] || false;
416+ var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
416− var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
417+ var artAndSummary = hasArt && hasSummary && !isConciergeMode;
417 var isHorizontal = template["card-layout"] === "horizontal";
418 var isHorizontal = template["card-layout"] === "horizontal";
418 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
419 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
419 (hasSummary && (template["card-background"] || components["background"]));
420 (hasSummary && (template["card-background"] || components["background"]));
@@ -483,17 +484,21 @@ function cardString(template, components) {
483 heightCode = 'width / artShape.aspect';
484 heightCode = 'width / artShape.aspect';
484 }
485 }
485
486
487+ var aspectRatio = components["art"] && components["art"]["aspect-ratio"] || 1;
488+ if (isNaN(aspectRatio)) {
489+ aspectRatio = 1;
490+ }
486 var fallback = components["art"] && components["art"]["fallback"] || "";
491 var fallback = components["art"] && components["art"]["fallback"] || "";
487 fallback = encodeURI(fallback);
492 fallback = encodeURI(fallback);
488 var fallbackStatusCode = "";
493 var fallbackStatusCode = "";
489 var fallbackURICode = '""';
494 var fallbackURICode = '""';
490 if (fallback !== "") {
495 if (fallback !== "") {
491− // fallbackStatusCode has %5 in it because we want to substitute it for fallbackURICode
496+ // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
492− // which in kArtShapeHolderCode is %5
497+ // which in kArtShapeHolderCode is %7
493− fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %5;';
498+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %7;';
494 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
499 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
495 }
500 }
496− code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(fallbackStatusCode).arg(fallbackURICode);
501+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(isConciergeMode ? "false" : "true").arg(aspectRatio).arg(fallbackStatusCode).arg(fallbackURICode);
497 } else {
502 } else {
498 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
503 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
499 }
504 }
qml/Dash/CardCarousel.qml−1
@@ -64,7 +64,6 @@ DashRenderer {
64 item.fixedHeaderHeight = Qt.binding(function() { return carousel.headerHeight; });
64 item.fixedHeaderHeight = Qt.binding(function() { return carousel.headerHeight; });
65 item.height = Qt.binding(function() { return cardTool.cardHeight; });
65 item.height = Qt.binding(function() { return cardTool.cardHeight; });
66 item.cardData = Qt.binding(function() { return model; });
66 item.cardData = Qt.binding(function() { return model; });
67− item.components = Qt.binding(function() { return cardTool.components; });
68 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
67 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
69 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
68 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
70 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
69 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
qml/Dash/CardGrid.qml−1
@@ -70,7 +70,6 @@ DashRenderer {
70 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
70 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
71 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
71 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
72 item.cardData = Qt.binding(function() { return model; });
72 item.cardData = Qt.binding(function() { return model; });
73− item.components = Qt.binding(function() { return cardTool.components; });
74 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
73 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
75 item.scopeStyle = root.scopeStyle;
74 item.scopeStyle = root.scopeStyle;
76 item.artShapeStyle = root.artShapeStyle;
75 item.artShapeStyle = root.artShapeStyle;
qml/Dash/CardHorizontalList.qml−1
@@ -53,7 +53,6 @@ DashRenderer {
53 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
53 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
54 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
54 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
55 item.cardData = Qt.binding(function() { return model; });
55 item.cardData = Qt.binding(function() { return model; });
56− item.components = Qt.binding(function() { return cardTool.components; });
57 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
56 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
58 item.scopeStyle = root.scopeStyle;
57 item.scopeStyle = root.scopeStyle;
59 }
58 }
qml/Dash/CardTool.qml−1
@@ -220,7 +220,6 @@ Item {
220 onLoaded: {
220 onLoaded: {
221 item.objectName = "cardToolCard";
221 item.objectName = "cardToolCard";
222 item.asynchronous = false;
222 item.asynchronous = false;
223− item.components = Qt.binding(function() { return cardTool.components; });
224 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
223 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
225 item.height = Qt.binding(function() { return cardTool.cardHeight !== -1 ? cardTool.cardHeight : item.implicitHeight; });
224 item.height = Qt.binding(function() { return cardTool.cardHeight !== -1 ? cardTool.cardHeight : item.implicitHeight; });
226 }
225 }
qml/Dash/CardVerticalJournal.qml−1
@@ -72,7 +72,6 @@ DashRenderer {
72 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
72 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
73 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
73 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
74 item.cardData = Qt.binding(function() { return model; });
74 item.cardData = Qt.binding(function() { return model; });
75− item.components = Qt.binding(function() { return cardTool.components; });
76 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
75 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
77 item.scopeStyle = root.scopeStyle;
76 item.scopeStyle = root.scopeStyle;
78 }
77 }
tests/plugins/Dash/cardcreator/1.res+3−5
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
@@ -31,7 +30,6 @@ Item {
31 sourceComponent: Item {
30 sourceComponent: Item {
32 id: artShape;
31 id: artShape;
33 objectName: "artShape";
32 objectName: "artShape";
34− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
36 readonly property alias image: artImage;
34 readonly property alias image: artImage;
37 ShaderEffectSource {
35 ShaderEffectSource {
@@ -40,11 +38,11 @@ Item {
40 anchors.centerIn: parent;
38 anchors.centerIn: parent;
41 width: 1;
39 width: 1;
42 height: 1;
40 height: 1;
43− hideSource: doShapeItem;
41+ hideSource: true;
44 }
42 }
45 Loader {
43 Loader {
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: artShape.doShapeItem;
45+ visible: true;
48 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
46 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
49 Component {
47 Component {
50 id: artShapeShapeComponent;
48 id: artShapeShapeComponent;
@@ -68,7 +66,7 @@ Item {
68 }
66 }
69 }
67 }
70 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
71− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
72 Component.onCompleted: { updateWidthHeightBindings(); }
70 Component.onCompleted: { updateWidthHeightBindings(); }
73 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
71 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
74 function updateWidthHeightBindings() {
72 function updateWidthHeightBindings() {
tests/plugins/Dash/cardcreator/10.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/plugins/Dash/cardcreator/11.res+3−5
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
@@ -69,7 +68,6 @@ Item {
69 sourceComponent: Item {
68 sourceComponent: Item {
70 id: artShape;
69 id: artShape;
71 objectName: "artShape";
70 objectName: "artShape";
72− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
73 visible: image.status == Image.Ready;
71 visible: image.status == Image.Ready;
74 readonly property alias image: artImage;
72 readonly property alias image: artImage;
75 ShaderEffectSource {
73 ShaderEffectSource {
@@ -78,11 +76,11 @@ Item {
78 anchors.centerIn: parent;
76 anchors.centerIn: parent;
79 width: 1;
77 width: 1;
80 height: 1;
78 height: 1;
81− hideSource: doShapeItem;
79+ hideSource: true;
82 }
80 }
83 Loader {
81 Loader {
84 anchors.fill: parent;
82 anchors.fill: parent;
85− visible: artShape.doShapeItem;
83+ visible: true;
86 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
84 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
87 Component {
85 Component {
88 id: artShapeShapeComponent;
86 id: artShapeShapeComponent;
@@ -106,7 +104,7 @@ Item {
106 }
104 }
107 }
105 }
108 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
106 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
109− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
107+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
110 Component.onCompleted: { updateWidthHeightBindings(); }
108 Component.onCompleted: { updateWidthHeightBindings(); }
111 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
109 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
112 function updateWidthHeightBindings() {
110 function updateWidthHeightBindings() {
tests/plugins/Dash/cardcreator/2.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/plugins/Dash/cardcreator/3.res+3−5
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
@@ -31,7 +30,6 @@ Item {
31 sourceComponent: Item {
30 sourceComponent: Item {
32 id: artShape;
31 id: artShape;
33 objectName: "artShape";
32 objectName: "artShape";
34− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
36 readonly property alias image: artImage;
34 readonly property alias image: artImage;
37 ShaderEffectSource {
35 ShaderEffectSource {
@@ -40,11 +38,11 @@ Item {
40 anchors.centerIn: parent;
38 anchors.centerIn: parent;
41 width: 1;
39 width: 1;
42 height: 1;
40 height: 1;
43− hideSource: doShapeItem;
41+ hideSource: true;
44 }
42 }
45 Loader {
43 Loader {
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: artShape.doShapeItem;
45+ visible: true;
48 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
46 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
49 Component {
47 Component {
50 id: artShapeShapeComponent;
48 id: artShapeShapeComponent;
@@ -68,7 +66,7 @@ Item {
68 }
66 }
69 }
67 }
70 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
71− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
72 Component.onCompleted: { updateWidthHeightBindings(); }
70 Component.onCompleted: { updateWidthHeightBindings(); }
73 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
71 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
74 function updateWidthHeightBindings() {
72 function updateWidthHeightBindings() {
tests/plugins/Dash/cardcreator/4.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/plugins/Dash/cardcreator/5.res+3−5
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
@@ -31,7 +30,6 @@ Item {
31 sourceComponent: Item {
30 sourceComponent: Item {
32 id: artShape;
31 id: artShape;
33 objectName: "artShape";
32 objectName: "artShape";
34− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
36 readonly property alias image: artImage;
34 readonly property alias image: artImage;
37 ShaderEffectSource {
35 ShaderEffectSource {
@@ -40,11 +38,11 @@ Item {
40 anchors.centerIn: parent;
38 anchors.centerIn: parent;
41 width: 1;
39 width: 1;
42 height: 1;
40 height: 1;
43− hideSource: doShapeItem;
41+ hideSource: false;
44 }
42 }
45 Loader {
43 Loader {
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: artShape.doShapeItem;
45+ visible: false;
48 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
46 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
49 Component {
47 Component {
50 id: artShapeShapeComponent;
48 id: artShapeShapeComponent;
@@ -68,7 +66,7 @@ Item {
68 }
66 }
69 }
67 }
70 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
71− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
72 Component.onCompleted: { updateWidthHeightBindings(); }
70 Component.onCompleted: { updateWidthHeightBindings(); }
73 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
71 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
74 function updateWidthHeightBindings() {
72 function updateWidthHeightBindings() {
tests/plugins/Dash/cardcreator/5.tst+1−1
@@ -1,3 +1,3 @@
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
2−components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
2+components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
3result: 5.res
3result: 5.res
tests/plugins/Dash/cardcreator/6.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/plugins/Dash/cardcreator/7.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/plugins/Dash/cardcreator/8.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
3+ property var cardData;
4− property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
7 property real fontScale: 1.0;
6 property real fontScale: 1.0;
tests/plugins/Dash/cardcreator/9.res−1
@@ -1,6 +1,5 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3− property var components;
4 property var cardData;
3 property var cardData;
5 property string artShapeStyle: "inset";
4 property string artShapeStyle: "inset";
6 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
tests/qmltests/Dash/tst_Card.qml−1
@@ -130,7 +130,6 @@ Rectangle {
130 sourceComponent: cardTool.cardComponent
130 sourceComponent: cardTool.cardComponent
131 clip: true
131 clip: true
132 onLoaded: {
132 onLoaded: {
133− item.components = Qt.binding(function() { return cardTool.components; });
134 item.cardData = Qt.binding(function() { return Helpers.mapData(dataArea.text, cardTool.components, dataError); });
133 item.cardData = Qt.binding(function() { return Helpers.mapData(dataArea.text, cardTool.components, dataError); });
135 item.width = Qt.binding(function() { return cardTool.cardWidth || item.implicitWidth; });
134 item.width = Qt.binding(function() { return cardTool.cardWidth || item.implicitWidth; });
136 item.height = Qt.binding(function() { return cardTool.cardHeight || item.implicitHeight; });
135 item.height = Qt.binding(function() { return cardTool.cardHeight || item.implicitHeight; });
tests/qmltests/Dash/tst_CardBenchmark.qml−2
@@ -61,8 +61,6 @@ Rectangle {
61 item.width = Qt.binding(function() { return cardTool.cardWidth || implicitWidth; });
61 item.width = Qt.binding(function() { return cardTool.cardWidth || implicitWidth; });
62 item.height = Qt.binding(function() { return cardTool.cardHeight || implicitHeight; });
62 item.height = Qt.binding(function() { return cardTool.cardHeight || implicitHeight; });
63 item.cardData = Qt.binding(function() { return Helpers.mapData(root.cardData, cardTool.components); });
63 item.cardData = Qt.binding(function() { return Helpers.mapData(root.cardData, cardTool.components); });
64− item.template = Qt.binding(function() { return cardTool.template; });
65− item.components = Qt.binding(function() { return cardTool.components; });
66 }
64 }
67 }
65 }
68 }
66 }