on xenial help sign in
Put the touchdown shape inside a loader
9552e73Albert Astals Cid
plugins/Dash/CardCreator.js+8−6
@@ -339,13 +339,15 @@ var kEmblemIconCode = 'Icon { \n\
339 }\n';
339 }\n';
340
340
341// %1 is used as anchors of touchdown effect
341// %1 is used as anchors of touchdown effect
342−var kTouchdownCode = 'UbuntuShape { \n\
342+var kTouchdownCode = 'Loader { \n\
343− id: touchdown; \n\
343+ active: root.pressed; \n\
344− objectName: "touchdown"; \n\
345 anchors { %1 } \n\
344 anchors { %1 } \n\
346− visible: root.pressed; \n\
345+ sourceComponent: UbuntuShape { \n\
346+ objectName: "touchdown"; \n\
347+ anchors.fill: parent; \n\
347− radius: "medium"; \n\
348+ radius: "medium"; \n\
348− borderSource: "radius_pressed.sci" \n\
349+ borderSource: "radius_pressed.sci" \n\
350+ } \n\
349 }\n';
351 }\n';
350
352
351// %1 is used as anchors of subtitleLabel
353// %1 is used as anchors of subtitleLabel
tests/plugins/Dash/cardcreator/1.res+8−6
@@ -72,13 +72,15 @@ Label {
72 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
72 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
73 horizontalAlignment: Text.AlignHCenter;
73 horizontalAlignment: Text.AlignHCenter;
74 }
74 }
75−UbuntuShape {
75+Loader {
76− id: touchdown;
76+ active: root.pressed;
77− objectName: "touchdown";
78 anchors { fill: artShapeHolder }
77 anchors { fill: artShapeHolder }
79− visible: root.pressed;
78+ sourceComponent: UbuntuShape {
79+ objectName: "touchdown";
80+ anchors.fill: parent;
80− radius: "medium";
81+ radius: "medium";
81− borderSource: "radius_pressed.sci"
82+ borderSource: "radius_pressed.sci"
83+ }
82}
84}
83implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
85implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
84}
86}
tests/plugins/Dash/cardcreator/1.res.cardcreator+8−6
@@ -70,13 +70,15 @@ Label {
70 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
70 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
71 horizontalAlignment: Text.AlignHCenter;
71 horizontalAlignment: Text.AlignHCenter;
72 }
72 }
73−UbuntuShape {
73+Loader {
74− id: touchdown;
74+ active: root.pressed;
75− objectName: "touchdown";
76 anchors { fill: artShapeHolder }
75 anchors { fill: artShapeHolder }
77− visible: root.pressed;
76+ sourceComponent: UbuntuShape {
77+ objectName: "touchdown";
78+ anchors.fill: parent;
78− radius: "medium";
79+ radius: "medium";
79− borderSource: "radius_pressed.sci"
80+ borderSource: "radius_pressed.sci"
81+ }
80}
82}
81implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
83implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
82}
84}
tests/plugins/Dash/cardcreator/11.res+10−8
@@ -166,13 +166,15 @@ top: titleLabel.bottom;
166
166
167 ]
167 ]
168 }
168 }
169+Loader {
170+ active: root.pressed;
171+ anchors { fill: backgroundLoader }
169−UbuntuShape {
172+ sourceComponent: UbuntuShape {
170− id: touchdown;
171− objectName: "touchdown";
173+ objectName: "touchdown";
172− anchors { fill: backgroundLoader }
174+ anchors.fill: parent;
173− visible: root.pressed;
174− radius: "medium";
175+ radius: "medium";
175− borderSource: "radius_pressed.sci"
176+ borderSource: "radius_pressed.sci"
177+ }
176− }
178+}
177implicitHeight: row.y + row.height + units.gu(1);
179implicitHeight: row.y + row.height + units.gu(1);
178}
180}
tests/plugins/Dash/cardcreator/11.res.cardcreator+10−8
@@ -161,13 +161,15 @@ top: titleLabel.bottom;
161
161
162 ]
162 ]
163 }
163 }
164+Loader {
165+ active: root.pressed;
166+ anchors { fill: backgroundLoader }
164−UbuntuShape {
167+ sourceComponent: UbuntuShape {
165− id: touchdown;
166− objectName: "touchdown";
168+ objectName: "touchdown";
167− anchors { fill: backgroundLoader }
169+ anchors.fill: parent;
168− visible: root.pressed;
169− radius: "medium";
170+ radius: "medium";
170− borderSource: "radius_pressed.sci"
171+ borderSource: "radius_pressed.sci"
172+ }
171− }
173+}
172implicitHeight: row.y + row.height + units.gu(1);
174implicitHeight: row.y + row.height + units.gu(1);
173}
175}
tests/plugins/Dash/cardcreator/12.res+8−6
@@ -98,13 +98,15 @@ CardSocialActions {
98 model: cardData && cardData["socialActions"];
98 model: cardData && cardData["socialActions"];
99 onClicked: root.action(actionId);
99 onClicked: root.action(actionId);
100}
100}
101−UbuntuShape {
101+Loader {
102− id: touchdown;
102+ active: root.pressed;
103− objectName: "touchdown";
104 anchors { fill: artShapeHolder }
103 anchors { fill: artShapeHolder }
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: socialActionsRow.y + socialActionsRow.height + units.gu(1);
111implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
110}
112}
tests/plugins/Dash/cardcreator/12.res.cardcreator+8−6
@@ -96,13 +96,15 @@ CardSocialActions {
96 model: cardData && cardData["socialActions"];
96 model: cardData && cardData["socialActions"];
97 onClicked: root.action(actionId);
97 onClicked: root.action(actionId);
98}
98}
99−UbuntuShape {
99+Loader {
100− id: touchdown;
100+ active: root.pressed;
101− objectName: "touchdown";
102 anchors { fill: artShapeHolder }
101 anchors { fill: artShapeHolder }
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: socialActionsRow.y + socialActionsRow.height + units.gu(1);
109implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
108}
110}
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() {