on xenial help sign in
Document and limit what you can do with subtitleLabelCode substitutions
commit619df75cc7733d0f3f3e543bec72599547cbf749 authorAlbert Astals <albert.astals@canonical.com> dateWed 7 May 2014, 15:02 (12 years ago) parent172c898
3 files changed+19−18
plugins/Dash/CardCreator.js+9−7 tests/plugins/Dash/cardcreator/3.res+5−6 tests/plugins/Dash/cardcreator/5.res+5−5
plugins/Dash/CardCreator.js+9−7
@@ -204,10 +204,12 @@ var titleLabelCode = 'Label { \n\
204204 horizontalAlignment: root.headerAlignment; \n\
205205 }\n';
206206
207+// %1 is used as anchors of subtitleLabel
208+// %2 is used as color of subtitleLabel
207209var subtitleLabelCode = 'Label { \n\
208210 id: subtitleLabel; \n\
209211 objectName: "subtitleLabel"; \n\
210− %1 \n\
212+ anchors { %1 } \n\
211213 elide: Text.ElideRight; \n\
212214 fontSize: "small"; \n\
213215 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
@@ -381,7 +383,7 @@ function cardString(template, components) {
381383 if (hasMascot && hasSubtitle) {
382384 // Using row + column
383385 titleAnchors = 'anchors { left: parent.left; right: parent.right }\n';
384− subtitleAnchors = titleAnchors;
386+ subtitleAnchors = 'left: parent.left; right: parent.right';
385387 } else if (hasMascot) {
386388 // Using row + label
387389 titleAnchors = 'anchors.verticalCenter: parent.verticalCenter;\n'
@@ -399,11 +401,11 @@ function cardString(template, components) {
399401 titleAnchors += headerLeftAnchor;
400402 titleAnchors += headerVerticalAnchors;
401403 }
402− subtitleAnchors = 'anchors.left: titleLabel.left; \n\
403− anchors.leftMargin: titleLabel.leftMargin; \n\
404− anchors.right: titleLabel.right; \n\
405− anchors.top: titleLabel.bottom; \n\
406− anchors.topMargin: units.dp(2);\n';
404+ subtitleAnchors = 'left: titleLabel.left; \n\
405+ leftMargin: titleLabel.leftMargin; \n\
406+ right: titleLabel.right; \n\
407+ top: titleLabel.bottom; \n\
408+ topMargin: units.dp(2);\n';
407409 }
408410
409411 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
tests/plugins/Dash/cardcreator/3.res+5−6
@@ -78,12 +78,11 @@ anchors.top: artShapeHolder.bottom;
7878Label {
7979 id: subtitleLabel;
8080 objectName: "subtitleLabel";
81− anchors.left: titleLabel.left;
82− anchors.leftMargin: titleLabel.leftMargin;
83− anchors.right: titleLabel.right;
84− anchors.top: titleLabel.bottom;
85− anchors.topMargin: units.dp(2);
86−
81+ anchors { left: titleLabel.left;
82+ leftMargin: titleLabel.leftMargin;
83+ right: titleLabel.right;
84+ top: titleLabel.bottom;
85+ topMargin: units.dp(2); }
8786 elide: Text.ElideRight;
8887 fontSize: "small";
8988 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
tests/plugins/Dash/cardcreator/5.res+5−5
@@ -121,11 +121,11 @@ Label {
121121Label {
122122 id: subtitleLabel;
123123 objectName: "subtitleLabel";
124− anchors.left: titleLabel.left;
125− anchors.leftMargin: titleLabel.leftMargin;
126− anchors.right: titleLabel.right;
127− anchors.top: titleLabel.bottom;
128− anchors.topMargin: units.dp(2);
124+ anchors { left: titleLabel.left;
125+ leftMargin: titleLabel.leftMargin;
126+ right: titleLabel.right;
127+ top: titleLabel.bottom;
128+ topMargin: units.dp(2); }
129129
130130 elide: Text.ElideRight;
131131 fontSize: "small";