on xenial help sign in
Put the touchdown shape inside a loader
d2acd8fAlbert Astals Cid
plugins/Dash/CardCreator.js+8−6
@@ -331,13 +331,15 @@ var kEmblemIconCode = 'Icon { \n\
331 }\n';
331 }\n';
332
332
333// %1 is used as anchors of touchdown effect
333// %1 is used as anchors of touchdown effect
334−var kTouchdownCode = 'UbuntuShape { \n\
334+var kTouchdownCode = 'Loader { \n\
335− id: touchdown; \n\
335+ active: root.pressed; \n\
336− objectName: "touchdown"; \n\
337 anchors { %1 } \n\
336 anchors { %1 } \n\
338− visible: root.pressed; \n\
337+ sourceComponent: UbuntuShape { \n\
338+ objectName: "touchdown"; \n\
339+ anchors.fill: parent; \n\
339− radius: "medium"; \n\
340+ radius: "medium"; \n\
340− borderSource: "radius_pressed.sci" \n\
341+ borderSource: "radius_pressed.sci" \n\
342+ } \n\
341 }\n';
343 }\n';
342
344
343// %1 is used as anchors of subtitleLabel
345// %1 is used as anchors of subtitleLabel
tests/plugins/Dash/cardcreator/1.res+8−6
@@ -69,13 +69,15 @@ Label {
69 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
69 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
70 horizontalAlignment: Text.AlignHCenter;
70 horizontalAlignment: Text.AlignHCenter;
71 }
71 }
72−UbuntuShape {
72+Loader {
73− id: touchdown;
73+ active: root.pressed;
74− objectName: "touchdown";
75 anchors { fill: artShapeLoader }
74 anchors { fill: artShapeLoader }
76− visible: root.pressed;
75+ sourceComponent: UbuntuShape {
76+ objectName: "touchdown";
77+ anchors.fill: parent;
77− radius: "medium";
78+ radius: "medium";
78− borderSource: "radius_pressed.sci"
79+ borderSource: "radius_pressed.sci"
80+ }
79}
81}
80implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
82implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
81}
83}
tests/plugins/Dash/cardcreator/1.res.cardcreator+8−6
@@ -65,13 +65,15 @@ Label {
65 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
65 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
66 horizontalAlignment: Text.AlignHCenter;
66 horizontalAlignment: Text.AlignHCenter;
67 }
67 }
68−UbuntuShape {
68+Loader {
69− id: touchdown;
69+ active: root.pressed;
70− objectName: "touchdown";
71 anchors { fill: artShapeLoader }
70 anchors { fill: artShapeLoader }
72− visible: root.pressed;
71+ sourceComponent: UbuntuShape {
72+ objectName: "touchdown";
73+ anchors.fill: parent;
73− radius: "medium";
74+ radius: "medium";
74− borderSource: "radius_pressed.sci"
75+ borderSource: "radius_pressed.sci"
76+ }
75}
77}
76implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
78implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
77}
79}
tests/plugins/Dash/cardcreator/11.res+10−8
@@ -163,13 +163,15 @@ top: titleLabel.bottom;
163
163
164 ]
164 ]
165 }
165 }
166+Loader {
167+ active: root.pressed;
168+ anchors { fill: backgroundLoader }
166−UbuntuShape {
169+ sourceComponent: UbuntuShape {
167− id: touchdown;
168− objectName: "touchdown";
170+ objectName: "touchdown";
169− anchors { fill: backgroundLoader }
171+ anchors.fill: parent;
170− visible: root.pressed;
171− radius: "medium";
172+ radius: "medium";
172− borderSource: "radius_pressed.sci"
173+ borderSource: "radius_pressed.sci"
174+ }
173− }
175+}
174implicitHeight: row.y + row.height + units.gu(1);
176implicitHeight: row.y + row.height + units.gu(1);
175}
177}
tests/plugins/Dash/cardcreator/11.res.cardcreator+10−8
@@ -156,13 +156,15 @@ top: titleLabel.bottom;
156
156
157 ]
157 ]
158 }
158 }
159+Loader {
160+ active: root.pressed;
161+ anchors { fill: backgroundLoader }
159−UbuntuShape {
162+ sourceComponent: UbuntuShape {
160− id: touchdown;
161− objectName: "touchdown";
163+ objectName: "touchdown";
162− anchors { fill: backgroundLoader }
164+ anchors.fill: parent;
163− visible: root.pressed;
164− radius: "medium";
165+ radius: "medium";
165− borderSource: "radius_pressed.sci"
166+ borderSource: "radius_pressed.sci"
167+ }
166− }
168+}
167implicitHeight: row.y + row.height + units.gu(1);
169implicitHeight: row.y + row.height + units.gu(1);
168}
170}
tests/plugins/Dash/cardcreator/12.res+8−6
@@ -95,13 +95,15 @@ CardSocialActions {
95 model: cardData && cardData["socialActions"];
95 model: cardData && cardData["socialActions"];
96 onClicked: root.action(actionId);
96 onClicked: root.action(actionId);
97}
97}
98−UbuntuShape {
98+Loader {
99− id: touchdown;
99+ active: root.pressed;
100− objectName: "touchdown";
101 anchors { fill: artShapeLoader }
100 anchors { fill: artShapeLoader }
102− visible: root.pressed;
101+ sourceComponent: UbuntuShape {
102+ objectName: "touchdown";
103+ anchors.fill: parent;
103− radius: "medium";
104+ radius: "medium";
104− borderSource: "radius_pressed.sci"
105+ borderSource: "radius_pressed.sci"
106+ }
105}
107}
106implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
108implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
107}
109}
tests/plugins/Dash/cardcreator/12.res.cardcreator+8−6
@@ -91,13 +91,15 @@ CardSocialActions {
91 model: cardData && cardData["socialActions"];
91 model: cardData && cardData["socialActions"];
92 onClicked: root.action(actionId);
92 onClicked: root.action(actionId);
93}
93}
94−UbuntuShape {
94+Loader {
95− id: touchdown;
95+ active: root.pressed;
96− objectName: "touchdown";
97 anchors { fill: artShapeLoader }
96 anchors { fill: artShapeLoader }
98− visible: root.pressed;
97+ sourceComponent: UbuntuShape {
98+ objectName: "touchdown";
99+ anchors.fill: parent;
99− radius: "medium";
100+ radius: "medium";
100− borderSource: "radius_pressed.sci"
101+ borderSource: "radius_pressed.sci"
102+ }
101}
103}
102implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
104implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
103}
105}
tests/plugins/Dash/cardcreator/4.res+8−6
@@ -98,13 +98,15 @@ Label {
98}
98}
99]
99]
100}
100}
101−UbuntuShape {
101+Loader {
102− id: touchdown;
102+ active: root.pressed;
103− objectName: "touchdown";
104 anchors { fill: root }
103 anchors { fill: root }
105− visible: root.pressed;
104+ sourceComponent: UbuntuShape {
105+ objectName: "touchdown";
106+ anchors.fill: parent;
106− radius: "medium";
107+ radius: "medium";
107− borderSource: "radius_pressed.sci"
108+ borderSource: "radius_pressed.sci"
109+ }
108}
110}
109implicitHeight: row.y + row.height + units.gu(1);
111implicitHeight: row.y + row.height + units.gu(1);
110}
112}
tests/plugins/Dash/cardcreator/4.res.cardcreator+8−6
@@ -95,13 +95,15 @@ Label {
95}
95}
96]
96]
97}
97}
98−UbuntuShape {
98+Loader {
99− id: touchdown;
99+ active: root.pressed;
100− objectName: "touchdown";
101 anchors { fill: root }
100 anchors { fill: root }
102− visible: root.pressed;
101+ sourceComponent: UbuntuShape {
102+ objectName: "touchdown";
103+ anchors.fill: parent;
103− radius: "medium";
104+ radius: "medium";
104− borderSource: "radius_pressed.sci"
105+ borderSource: "radius_pressed.sci"
106+ }
105}
107}
106implicitHeight: row.y + row.height + units.gu(1);
108implicitHeight: row.y + row.height + units.gu(1);
107}
109}
tests/plugins/Dash/cardcreator/6.res+8−6
@@ -114,13 +114,15 @@ Item {
114
114
115 ]
115 ]
116 }
116 }
117−UbuntuShape {
117+Loader {
118− id: touchdown;
118+ active: root.pressed;
119− objectName: "touchdown";
120 anchors { fill: backgroundLoader }
119 anchors { fill: backgroundLoader }
121− visible: root.pressed;
120+ sourceComponent: UbuntuShape {
121+ objectName: "touchdown";
122+ anchors.fill: parent;
122− radius: "medium";
123+ radius: "medium";
123− borderSource: "radius_pressed.sci"
124+ borderSource: "radius_pressed.sci"
125+ }
124}
126}
125implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
127implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
126}
128}
tests/plugins/Dash/cardcreator/6.res.cardcreator+8−6
@@ -112,13 +112,15 @@ Item {
112
112
113 ]
113 ]
114 }
114 }
115−UbuntuShape {
115+Loader {
116− id: touchdown;
116+ active: root.pressed;
117− objectName: "touchdown";
118 anchors { fill: backgroundLoader }
117 anchors { fill: backgroundLoader }
119− visible: root.pressed;
118+ sourceComponent: UbuntuShape {
119+ objectName: "touchdown";
120+ anchors.fill: parent;
120− radius: "medium";
121+ radius: "medium";
121− borderSource: "radius_pressed.sci"
122+ borderSource: "radius_pressed.sci"
123+ }
122}
124}
123implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
125implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
124}
126}
tests/plugins/Dash/cardcreator/8.res+8−6
@@ -96,13 +96,15 @@ left: parent.left;
96
96
97 ]
97 ]
98 }
98 }
99−UbuntuShape {
99+Loader {
100− id: touchdown;
100+ active: root.pressed;
101− objectName: "touchdown";
102 anchors { fill: backgroundLoader }
101 anchors { fill: backgroundLoader }
103− visible: root.pressed;
102+ sourceComponent: UbuntuShape {
103+ objectName: "touchdown";
104+ anchors.fill: parent;
104− radius: "medium";
105+ radius: "medium";
105− borderSource: "radius_pressed.sci"
106+ borderSource: "radius_pressed.sci"
107+ }
106}
108}
107implicitHeight: row.y + row.height + units.gu(1);
109implicitHeight: row.y + row.height + units.gu(1);
108}
110}
tests/plugins/Dash/cardcreator/8.res.cardcreator+8−6
@@ -93,13 +93,15 @@ left: parent.left;
93
93
94 ]
94 ]
95 }
95 }
96−UbuntuShape {
96+Loader {
97− id: touchdown;
97+ active: root.pressed;
98− objectName: "touchdown";
99 anchors { fill: backgroundLoader }
98 anchors { fill: backgroundLoader }
100− visible: root.pressed;
99+ sourceComponent: UbuntuShape {
100+ objectName: "touchdown";
101+ anchors.fill: parent;
101− radius: "medium";
102+ radius: "medium";
102− borderSource: "radius_pressed.sci"
103+ borderSource: "radius_pressed.sci"
104+ }
103}
105}
104implicitHeight: row.y + row.height + units.gu(1);
106implicitHeight: row.y + row.height + units.gu(1);
105}
107}
tests/plugins/Dash/cardcreator/9.res+10−8
@@ -107,13 +107,15 @@ CardAudioProgress {
107 onPressAndHold: {
107 onPressAndHold: {
108 root.pressAndHold();
108 root.pressAndHold();
109 }
109 }
110+ }Loader {
111+ active: root.pressed;
112+ anchors { fill: root }
110− }UbuntuShape {
113+ sourceComponent: UbuntuShape {
111− id: touchdown;
112− objectName: "touchdown";
114+ objectName: "touchdown";
113− anchors { fill: root }
115+ anchors.fill: parent;
114− visible: root.pressed;
115− radius: "medium";
116+ radius: "medium";
116− borderSource: "radius_pressed.sci"
117+ borderSource: "radius_pressed.sci"
118+ }
117− }
119+}
118implicitHeight: audioButton.height;
120implicitHeight: audioButton.height;
119}
121}
tests/plugins/Dash/cardcreator/9.res.cardcreator+10−8
@@ -105,13 +105,15 @@ CardAudioProgress {
105 onPressAndHold: {
105 onPressAndHold: {
106 root.pressAndHold();
106 root.pressAndHold();
107 }
107 }
108+ }Loader {
109+ active: root.pressed;
110+ anchors { fill: root }
108− }UbuntuShape {
111+ sourceComponent: UbuntuShape {
109− id: touchdown;
110− objectName: "touchdown";
112+ objectName: "touchdown";
111− anchors { fill: root }
113+ anchors.fill: parent;
112− visible: root.pressed;
113− radius: "medium";
114+ radius: "medium";
114− borderSource: "radius_pressed.sci"
115+ borderSource: "radius_pressed.sci"
116+ }
115− }
117+}
116implicitHeight: audioButton.height;
118implicitHeight: audioButton.height;
117}
119}
tests/qmltests/Dash/tst_Card.qml+7−2
@@ -618,12 +618,17 @@ Rectangle {
618 waitForRendering(card);
618 waitForRendering(card);
619
619
620 var touchdown = findChild(card, "touchdown");
620 var touchdown = findChild(card, "touchdown");
621+ compare(touchdown, null);
621
622
622− compare(touchdown.visible, false);
623 mousePress(card);
623 mousePress(card);
624+
625+ touchdown = findChild(card, "touchdown");
624 compare(touchdown.visible, true);
626 compare(touchdown.visible, true);
627+
625 mouseRelease(card);
628 mouseRelease(card);
629+
630+ touchdown = findChild(card, "touchdown");
626− compare(touchdown.visible, false);
631+ compare(touchdown, null);
627 }
632 }
628
633
629 function test_paddings_data() {
634 function test_paddings_data() {
tests/qmltests/Dash/tst_GenericScopeView.qml+15−5
@@ -629,11 +629,15 @@ Item {
629 var item0 = findChild(cardGrid, "delegate0");
629 var item0 = findChild(cardGrid, "delegate0");
630 waitForRendering(item0);
630 waitForRendering(item0);
631 compare(item0.enabled, false);
631 compare(item0.enabled, false);
632+
632 var touchdown = findChild(item0, "touchdown");
633 var touchdown = findChild(item0, "touchdown");
634+ compare(touchdown, null);
633
635
634− compare(touchdown.visible, false);
635 mousePress(item0);
636 mousePress(item0);
637+
638+ touchdown = findChild(item0, "touchdown");
636− compare(touchdown.visible, false);
639+ compare(touchdown, null);
640+
637 mouseRelease(item0);
641 mouseRelease(item0);
638
642
639 cardTool.template["non-interactive"] = false;
643 cardTool.template["non-interactive"] = false;
@@ -643,13 +647,19 @@ Item {
643 waitForRendering(category0);
647 waitForRendering(category0);
644 item0 = findChild(cardGrid, "delegate0");
648 item0 = findChild(cardGrid, "delegate0");
645 compare(item0.enabled, true);
649 compare(item0.enabled, true);
646− var touchdown = findChild(item0, "touchdown");
647
650
651+ touchdown = findChild(item0, "touchdown");
648− compare(touchdown.visible, false);
652+ compare(touchdown, null);
653+
649 mousePress(item0);
654 mousePress(item0);
655+
656+ touchdown = findChild(item0, "touchdown");
650 compare(touchdown.visible, true);
657 compare(touchdown.visible, true);
658+
651 mouseRelease(item0);
659 mouseRelease(item0);
660+
661+ touchdown = findChild(item0, "touchdown");
652− compare(touchdown.visible, false);
662+ compare(touchdown, null);
653 closePreview();
663 closePreview();
654 }
664 }
655
665