@@ -129,6 +129,51 @@ var kArtShapeHolderCode = 'Item { \n\
129129 } \n\
130130 }\n';
131131
132+// %1 is used as anchors of artShapeHolder
133+// %2 is used as image width
134+// %3 is used as image height
135+// %4 is whether the image should be visible
136+// %5 is used as aspect ratio
137+// %6 is whether the loader should be asynchronous or not
138+// %7 is the shape code we want to use
139+// %8 is injected as code to artImage
140+// %9 is used as image fallback
141+var kArtShapeHolderCodeCardToolCard = 'Item { \n\
142+ id: artShapeHolder; \n\
143+ height: artShapeLoader.height; \n\
144+ width: artShapeLoader.width; \n\
145+ anchors { %1 } \n\
146+ Loader { \n\
147+ id: artShapeLoader; \n\
148+ objectName: "artShapeLoader"; \n\
149+ readonly property string cardArt: cardData && cardData["art"] || %9; \n\
150+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
151+ active: cardArt != ""; \n\
152+ asynchronous: %6; \n\
153+ visible: status == Loader.Ready; \n\
154+ sourceComponent: Item { \n\
155+ id: artShape; \n\
156+ objectName: "artShape"; \n\
157+ visible: image.status == Image.Ready; \n\
158+ readonly property alias image: artImage; \n\
159+ %7 \n\
160+ readonly property real aspect: %5; \n\
161+ width: image.status !== Image.Ready ? 0 : image.width; \n\
162+ height: image.status !== Image.Ready ? 0 : image.height; \n\
163+ CroppedImageMinimumSourceSize { \n\
164+ id: artImage; \n\
165+ objectName: "artImage"; \n\
166+ source: artShapeLoader.cardArt; \n\
167+ asynchronous: %6; \n\
168+ visible: %4; \n\
169+ width: %2; \n\
170+ height: %3; \n\
171+ %8 \n\
172+ } \n\
173+ } \n\
174+ } \n\
175+ }\n';
176+
132177// %1 is anchors.fill
133178// %2 is width
134179// %3 is height
@@ -416,15 +461,16 @@ function cardString(template, components, isCardTool, artShapeStyle) {
416461 property string backgroundShapeStyle: "inset"; \n\
417462 property real fontScale: 1.0; \n\
418463 property var scopeStyle: null; \n\
419− %2\
420− property size fixedArtShapeSize: Qt.size(-1, -1); \n\
421464 readonly property string title: cardData && cardData["title"] || ""; \n\
422465 property bool showHeader: true; \n\
423466 implicitWidth: childrenRect.width; \n\
424467 enabled: %1; \n\
425468 \n'.arg(templateInteractive);
426469
427− code = code.arg(isCardTool ? "" : "property int fixedHeaderHeight: -1; \n");
470+ if (!isCardTool) {
471+ code += "property int fixedHeaderHeight: -1; \n\
472+ property size fixedArtShapeSize: Qt.size(-1, -1); \n";
473+ }
428474
429475 var hasArt = components["art"] && components["art"]["field"] || false;
430476 var hasSummary = components["summary"] || false;
@@ -533,15 +579,16 @@ function cardString(template, components, isCardTool, artShapeStyle) {
533579 } else {
534580 artShapeHolderShapeCode = "";
535581 }
536− code += kArtShapeHolderCode.arg(artAnchors)
537− .arg(widthCode)
538− .arg(heightCode)
539− .arg(isConciergeMode ? "true" : "false")
540− .arg(aspectRatio)
541− .arg(asynchronous)
542− .arg(artShapeHolderShapeCode)
543− .arg(fallbackStatusCode)
544− .arg(fallbackURICode);
582+ var artShapeHolderCode = isCardTool ? kArtShapeHolderCodeCardToolCard : kArtShapeHolderCode;
583+ code += artShapeHolderCode.arg(artAnchors)
584+ .arg(widthCode)
585+ .arg(heightCode)
586+ .arg(isConciergeMode ? "true" : "false")
587+ .arg(aspectRatio)
588+ .arg(asynchronous)
589+ .arg(artShapeHolderShapeCode)
590+ .arg(fallbackStatusCode)
591+ .arg(fallbackURICode);
545592 } else {
546593 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
547594 }