@@ -275,6 +275,7 @@ var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
275// %2 is used as color of titleLabel
275// %2 is used as color of titleLabel
276// %3 is used as extra condition for visible of titleLabel
276// %3 is used as extra condition for visible of titleLabel
277// %4 is used as title width
277// %4 is used as title width
278+// %5 is used as horizontal alignment
278var kTitleLabelCode = 'Label { \n\
279var kTitleLabelCode = 'Label { \n\
279 id: titleLabel; \n\
280 id: titleLabel; \n\
280 objectName: "titleLabel"; \n\
281 objectName: "titleLabel"; \n\
@@ -289,7 +290,7 @@ var kTitleLabelCode = 'Label { \n\
289 width: %4; \n\
290 width: %4; \n\
290 text: root.title; \n\
291 text: root.title; \n\
291 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
292 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
292− horizontalAlignment: root.titleAlignment; \n\
293+ horizontalAlignment: %5; \n\
295// %1 is used as extra anchors of emblemIcon
296// %1 is used as extra anchors of emblemIcon
@@ -410,7 +411,6 @@ function cardString(template, components) {
410 property string backgroundShapeStyle: "inset"; \n\
411 property string backgroundShapeStyle: "inset"; \n\
411 property real fontScale: 1.0; \n\
412 property real fontScale: 1.0; \n\
412 property var scopeStyle: null; \n\
413 property var scopeStyle: null; \n\
413− property int titleAlignment: Text.AlignLeft; \n\
414 property int fixedHeaderHeight: -1; \n\
414 property int fixedHeaderHeight: -1; \n\
415 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
415 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
416 readonly property string title: cardData && cardData["title"] || ""; \n\
416 readonly property string title: cardData && cardData["title"] || ""; \n\
@@ -715,9 +715,24 @@ function cardString(template, components) {
718+ var titleAlignment = "Text.AlignHCenter";
719+ if (template["card-layout"] === "horizontal"
720+ || typeof components["title"] !== "object"
721+ || components["title"]["align"] === "left") titleAlignment = "Text.AlignLeft";
722+ var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
723+ for (var key in keys) {
726+ if (typeof components[key] === "string"
727+ || typeof components[key]["field"] === "string") titleAlignment = "Text.AlignLeft";
718 // code for different elements
733 // code for different elements
719 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
734 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
720− var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth);
735+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth).arg(titleAlignment);
721 var subtitleCode;
736 var subtitleCode;
722 var attributesCode;
737 var attributesCode;