@@ -100,9 +100,23 @@ Item {
100100 }
101101 }
102102
103− property QtObject priv: card
103+ property var titleAlignment: {
104+ var subtitle = components["subtitle"];
105+ var price = components["price"];
106+ var summary = components["summary"];
107+
108+ var hasSubtitle = subtitle && (typeof subtitle === "string" || subtitle["field"])
109+ var hasPrice = price && (typeof price === "string" || subtitle["field"]);
110+ var hasSummary = summary && (typeof summary === "string" || summary["field"])
111+
112+ var isOnlyTextComponent = !hasSubtitle && !hasPrice && !hasSummary;
113+ if (!isOnlyTextComponent) return Text.AlignLeft;
114+
115+ return (template["card-layout"] === "horizontal") ? Text.AlignHCenter : Text.AlignLeft;
116+ }
117+
104118
105− property var titleAlignment: card.titleAlignment
119+ property QtObject priv: card
106120
107121 Card {
108122 id: card
@@ -112,19 +126,6 @@ Item {
112126 width: cardTool.cardWidth || implicitWidth
113127 height: cardTool.cardHeight || implicitHeight
114128
115− property var titleAlignment: {
116− var subtitle = components["subtitle"];
117− var price = components["price"];
118−
119− var hasSubtitle = subtitle && (typeof subtitle === "string" || subtitle["field"])
120− var hasPrice = price && (typeof price === "string" || subtitle["field"]);
121−
122− var isOnlyTextComponent = !hasSubtitle && !hasPrice;
123− if (!isOnlyTextComponent) return Text.AlignLeft;
124−
125− return (template["card-layout"] === "horizontal") ? Text.AlignHCenter : Text.AlignLeft;
126− }
127−
128129 property var fields: ["art", "mascot", "title", "subtitle", "summary"]
129130 property var maxData: {
130131 "art": Qt.resolvedUrl("graphics/checkers.png"),