on xenial help sign in
Merge titleAlignmentOnCompileTime
commit04aff457274f2d017da5be45c6ef44c52b14935d authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 17 Feb 2016, 10:54 (11 years ago) parent78a2267776276c
29 files changed+44−78
plugins/Dash/CardCreator.js+18−3 qml/Dash/CardCarousel.qml−1 qml/Dash/CardGrid.qml−1 qml/Dash/CardHorizontalList.qml−1 qml/Dash/CardTool.qml−23 qml/Dash/CardVerticalJournal.qml−1 tests/plugins/Dash/cardcreator/1.res+1−2 tests/plugins/Dash/cardcreator/1.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/10.res+1−2 tests/plugins/Dash/cardcreator/10.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/11.res+1−2 tests/plugins/Dash/cardcreator/11.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/2.res+1−2 tests/plugins/Dash/cardcreator/2.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/3.res+1−2 tests/plugins/Dash/cardcreator/3.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/4.res+1−2 tests/plugins/Dash/cardcreator/4.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/5.res+1−2 tests/plugins/Dash/cardcreator/5.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/6.res+1−2 tests/plugins/Dash/cardcreator/6.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/7.res+1−2 tests/plugins/Dash/cardcreator/7.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/8.res+1−2 tests/plugins/Dash/cardcreator/8.res.cardcreator+1−2 tests/plugins/Dash/cardcreator/9.res+1−2 tests/plugins/Dash/cardcreator/9.res.cardcreator+1−2 tests/qmltests/Dash/tst_CardTool.qml+4−4
plugins/Dash/CardCreator.js+18−3
@@ -287,6 +287,7 @@ var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
287287// %2 is used as color of titleLabel
288288// %3 is used as extra condition for visible of titleLabel
289289// %4 is used as title width
290+// %5 is used as horizontal alignment
290291var kTitleLabelCode = 'Label { \n\
291292 id: titleLabel; \n\
292293 objectName: "titleLabel"; \n\
@@ -301,7 +302,7 @@ var kTitleLabelCode = 'Label { \n\
301302 width: %4; \n\
302303 text: root.title; \n\
303304 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
304− horizontalAlignment: root.titleAlignment; \n\
305+ horizontalAlignment: %5; \n\
305306 }\n';
306307
307308// %1 is used as extra anchors of emblemIcon
@@ -422,7 +423,6 @@ function cardString(template, components, isCardTool) {
422423 property string backgroundShapeStyle: "inset"; \n\
423424 property real fontScale: 1.0; \n\
424425 property var scopeStyle: null; \n\
425− property int titleAlignment: Text.AlignLeft; \n\
426426 %2\
427427 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
428428 readonly property string title: cardData && cardData["title"] || ""; \n\
@@ -746,9 +746,24 @@ function cardString(template, components, isCardTool) {
746746 }
747747 }
748748
749+ var titleAlignment = "Text.AlignHCenter";
750+ if (template["card-layout"] === "horizontal"
751+ || typeof components["title"] !== "object"
752+ || components["title"]["align"] === "left") titleAlignment = "Text.AlignLeft";
753+ var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
754+ for (var key in keys) {
755+ key = keys[key];
756+ try {
757+ if (typeof components[key] === "string"
758+ || typeof components[key]["field"] === "string") titleAlignment = "Text.AlignLeft";
759+ } catch (e) {
760+ continue;
761+ }
762+ }
763+
749764 // code for different elements
750765 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
751− var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth);
766+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth).arg(titleAlignment);
752767 var subtitleCode;
753768 var attributesCode;
754769
qml/Dash/CardCarousel.qml−1
@@ -66,7 +66,6 @@ DashRenderer {
6666 item.cardData = Qt.binding(function() { return model; });
6767 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
6868 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
69− item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
7069 item.artShapeStyle = "shadow";
7170 item.scopeStyle = cardCarousel.scopeStyle;
7271 }
qml/Dash/CardGrid.qml−1
@@ -70,7 +70,6 @@ DashRenderer {
7070 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
7171 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
7272 item.cardData = Qt.binding(function() { return model; });
73− item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
7473 item.scopeStyle = root.scopeStyle;
7574 item.artShapeStyle = root.artShapeStyle;
7675 item.backgroundShapeStyle = root.backgroundShapeStyle;
qml/Dash/CardHorizontalList.qml−1
@@ -53,7 +53,6 @@ DashRenderer {
5353 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
5454 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
5555 item.cardData = Qt.binding(function() { return model; });
56− item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
5756 item.scopeStyle = root.scopeStyle;
5857 }
5958 Connections {
qml/Dash/CardTool.qml−23
@@ -139,29 +139,6 @@ Item {
139139 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
140140 property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0
141141
142− /*!
143− \brief Desired alignment of title
144− */
145− readonly property int titleAlignment: {
146− if (template["card-layout"] === "horizontal"
147− || typeof components["title"] !== "object"
148− || components["title"]["align"] === "left") return Text.AlignLeft;
149−
150− var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
151−
152− for (var key in keys) {
153− key = keys[key];
154− try {
155− if (typeof components[key] === "string"
156− || typeof components[key]["field"] === "string") return Text.AlignLeft;
157− } catch (e) {
158− continue;
159− }
160− }
161−
162− return Text.AlignHCenter;
163− }
164−
165142 QtObject {
166143 id: carouselTool
167144
qml/Dash/CardVerticalJournal.qml−1
@@ -72,7 +72,6 @@ DashRenderer {
7272 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
7373 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
7474 item.cardData = Qt.binding(function() { return model; });
75− item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
7675 item.scopeStyle = root.scopeStyle;
7776 }
7877 Connections {
tests/plugins/Dash/cardcreator/1.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -107,7 +106,7 @@ Label {
107106 width: undefined;
108107 text: root.title;
109108 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
110− horizontalAlignment: root.titleAlignment;
109+ horizontalAlignment: Text.AlignHCenter;
111110 }
112111UbuntuShape {
113112 id: touchdown;
tests/plugins/Dash/cardcreator/1.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -106,7 +105,7 @@ Label {
106105 width: undefined;
107106 text: root.title;
108107 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
109− horizontalAlignment: root.titleAlignment;
108+ horizontalAlignment: Text.AlignHCenter;
110109 }
111110UbuntuShape {
112111 id: touchdown;
tests/plugins/Dash/cardcreator/10.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -102,7 +101,7 @@ left: parent.left;
102101 width: undefined;
103102 text: root.title;
104103 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
105− horizontalAlignment: root.titleAlignment;
104+ horizontalAlignment: Text.AlignLeft;
106105 }
107106,Label {
108107 id: subtitleLabel;
tests/plugins/Dash/cardcreator/10.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -100,7 +99,7 @@ left: parent.left;
10099 width: undefined;
101100 text: root.title;
102101 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
103− horizontalAlignment: root.titleAlignment;
102+ horizontalAlignment: Text.AlignLeft;
104103 }
105104,Label {
106105 id: subtitleLabel;
tests/plugins/Dash/cardcreator/11.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -177,7 +176,7 @@ left: parent.left;
177176 width: undefined;
178177 text: root.title;
179178 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
180− horizontalAlignment: root.titleAlignment;
179+ horizontalAlignment: Text.AlignLeft;
181180 }
182181,Label {
183182 id: subtitleLabel;
tests/plugins/Dash/cardcreator/11.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -173,7 +172,7 @@ left: parent.left;
173172 width: undefined;
174173 text: root.title;
175174 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
176− horizontalAlignment: root.titleAlignment;
175+ horizontalAlignment: Text.AlignLeft;
177176 }
178177,Label {
179178 id: subtitleLabel;
tests/plugins/Dash/cardcreator/2.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -101,7 +100,7 @@ CroppedImageMinimumSourceSize {
101100 width: undefined;
102101 text: root.title;
103102 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
104− horizontalAlignment: root.titleAlignment;
103+ horizontalAlignment: Text.AlignLeft;
105104 }
106105 ,Label {
107106 id: subtitleLabel;
tests/plugins/Dash/cardcreator/2.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -99,7 +98,7 @@ CroppedImageMinimumSourceSize {
9998 width: undefined;
10099 text: root.title;
101100 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
102− horizontalAlignment: root.titleAlignment;
101+ horizontalAlignment: Text.AlignLeft;
103102 }
104103 ,Label {
105104 id: subtitleLabel;
tests/plugins/Dash/cardcreator/3.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -108,7 +107,7 @@ Label {
108107 width: undefined;
109108 text: root.title;
110109 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
111− horizontalAlignment: root.titleAlignment;
110+ horizontalAlignment: Text.AlignLeft;
112111 }
113112Label {
114113 id: subtitleLabel;
tests/plugins/Dash/cardcreator/3.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -106,7 +105,7 @@ Label {
106105 width: undefined;
107106 text: root.title;
108107 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
109− horizontalAlignment: root.titleAlignment;
108+ horizontalAlignment: Text.AlignLeft;
110109 }
111110Label {
112111 id: subtitleLabel;
tests/plugins/Dash/cardcreator/4.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -76,7 +75,7 @@ Label {
7675 width: undefined;
7776 text: root.title;
7877 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
79− horizontalAlignment: root.titleAlignment;
78+ horizontalAlignment: Text.AlignLeft;
8079 }
8180,Label {
8281 id: subtitleLabel;
tests/plugins/Dash/cardcreator/4.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -74,7 +73,7 @@ Label {
7473 width: undefined;
7574 text: root.title;
7675 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
77− horizontalAlignment: root.titleAlignment;
76+ horizontalAlignment: Text.AlignLeft;
7877 }
7978,Label {
8079 id: subtitleLabel;
tests/plugins/Dash/cardcreator/5.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -125,7 +124,7 @@ Label {
125124 width: undefined;
126125 text: root.title;
127126 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
128− horizontalAlignment: root.titleAlignment;
127+ horizontalAlignment: Text.AlignLeft;
129128 }
130129Label {
131130 id: subtitleLabel;
tests/plugins/Dash/cardcreator/5.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -124,7 +123,7 @@ Label {
124123 width: undefined;
125124 text: root.title;
126125 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
127− horizontalAlignment: root.titleAlignment;
126+ horizontalAlignment: Text.AlignLeft;
128127 }
129128Label {
130129 id: subtitleLabel;
tests/plugins/Dash/cardcreator/6.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -80,7 +79,7 @@ Item {
8079 width: undefined;
8180 text: root.title;
8281 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
83− horizontalAlignment: root.titleAlignment;
82+ horizontalAlignment: Text.AlignLeft;
8483 }
8584,Label {
8685 id: subtitleLabel;
tests/plugins/Dash/cardcreator/6.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -79,7 +78,7 @@ Item {
7978 width: undefined;
8079 text: root.title;
8180 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
82− horizontalAlignment: root.titleAlignment;
81+ horizontalAlignment: Text.AlignLeft;
8382 }
8483,Label {
8584 id: subtitleLabel;
tests/plugins/Dash/cardcreator/7.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -102,7 +101,7 @@ CroppedImageMinimumSourceSize {
102101 width: undefined;
103102 text: root.title;
104103 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
105− horizontalAlignment: root.titleAlignment;
104+ horizontalAlignment: Text.AlignLeft;
106105 }
107106,Label {
108107 id: subtitleLabel;
tests/plugins/Dash/cardcreator/7.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -100,7 +99,7 @@ CroppedImageMinimumSourceSize {
10099 width: undefined;
101100 text: root.title;
102101 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
103− horizontalAlignment: root.titleAlignment;
102+ horizontalAlignment: Text.AlignLeft;
104103 }
105104,Label {
106105 id: subtitleLabel;
tests/plugins/Dash/cardcreator/8.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -93,7 +92,7 @@ left: parent.left;
9392 width: parent.width - x;
9493 text: root.title;
9594 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
96− horizontalAlignment: root.titleAlignment;
95+ horizontalAlignment: Text.AlignLeft;
9796 }
9897
9998 ]
tests/plugins/Dash/cardcreator/8.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -91,7 +90,7 @@ left: parent.left;
9190 width: parent.width - x;
9291 text: root.title;
9392 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
94− horizontalAlignment: root.titleAlignment;
93+ horizontalAlignment: Text.AlignLeft;
9594 }
9695
9796 ]
tests/plugins/Dash/cardcreator/9.res+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property int fixedHeaderHeight: -1;
109 property size fixedArtShapeSize: Qt.size(-1, -1);
1110 readonly property string title: cardData && cardData["title"] || "";
@@ -35,7 +34,7 @@ top: parent.top;
3534 width: undefined;
3635 text: root.title;
3736 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
38− horizontalAlignment: root.titleAlignment;
37+ horizontalAlignment: Text.AlignLeft;
3938 }
4039Label {
4140 id: subtitleLabel;
tests/plugins/Dash/cardcreator/9.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
55 property string backgroundShapeStyle: "inset";
66 property real fontScale: 1.0;
77 property var scopeStyle: null;
8− property int titleAlignment: Text.AlignLeft;
98 property size fixedArtShapeSize: Qt.size(-1, -1);
109 readonly property string title: cardData && cardData["title"] || "";
1110 property bool showHeader: true;
@@ -34,7 +33,7 @@ top: parent.top;
3433 width: undefined;
3534 text: root.title;
3635 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
37− horizontalAlignment: root.titleAlignment;
36+ horizontalAlignment: Text.AlignLeft;
3837 }
3938Label {
4039 id: subtitleLabel;
tests/qmltests/Dash/tst_CardTool.qml+4−4
@@ -339,22 +339,22 @@ Rectangle {
339339 function test_card_title_alignment(data) {
340340 selector.selectedIndex = data.index;
341341
342− tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
342+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == Text.AlignLeft; }, true);
343343
344344 cardTool.components['title'] = { "field": "title", "align": "center" };
345345 cardTool.componentsChanged();
346346
347− tryCompare(cardTool, "titleAlignment", data.value);
347+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == data.value; }, true);
348348
349349 cardTool.components['title'] = { "field": "title" };
350350 cardTool.componentsChanged();
351351
352− tryCompare(cardTool, "titleAlignment", data.value);
352+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == data.value; }, true);
353353
354354 cardTool.components['title'] = { "field": "title", "align": "left" };
355355 cardTool.componentsChanged();
356356
357− tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
357+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == Text.AlignLeft; }, true);
358358 }
359359
360360 function test_categoryLayout_data() {