on xenial help sign in
Add non-interactive code into GenericScopeView. Fixes: 1384441

Approved by: Albert Astals Cid

commitb054b248328d63a9d8bc4256fcc2d06c22361af6 authorYing-Chun Liu <paul.liu@canonical.com> dateThu 30 Oct 2014, 21:41 (12 years ago) parent0813bd28c14533
9 files changed+51−2
plugins/Dash/CardCreator.js+3−1 tests/plugins/Dash/cardcreator/1.res+2 tests/plugins/Dash/cardcreator/2.res+2 tests/plugins/Dash/cardcreator/3.res+2 tests/plugins/Dash/cardcreator/4.res+2 tests/plugins/Dash/cardcreator/5.res+3−1 tests/plugins/Dash/cardcreator/6.res+2 tests/plugins/Dash/cardcreator/7.res+2 tests/qmltests/Dash/tst_GenericScopeView.qml+33
plugins/Dash/CardCreator.js+3−1
@@ -313,7 +313,9 @@ function cardString(template, components) {
313313 readonly property string title: cardData && cardData["title"] || ""; \n\
314314 property bool asynchronous: true; \n\
315315 property bool showHeader: true; \n\
316− implicitWidth: childrenRect.width; \n';
316+ implicitWidth: childrenRect.width; \n\
317+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true); \n\
318+ \n';
317319
318320 var hasArt = components["art"] && components["art"]["field"] || false;
319321 var hasSummary = components["summary"] || false;
tests/plugins/Dash/cardcreator/1.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1719readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1820Item {
tests/plugins/Dash/cardcreator/2.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618Loader {
1719 id: backgroundLoader;
1820 objectName: "backgroundLoader";
tests/plugins/Dash/cardcreator/3.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1719readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1820Item {
tests/plugins/Dash/cardcreator/4.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618readonly property size artShapeSize: Qt.size(-1, -1);
1719readonly property int headerHeight: row.height;
1820Row {
tests/plugins/Dash/cardcreator/5.res+3−1
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1719readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1820Item {
@@ -143,7 +145,7 @@ UbuntuShape {
143145 id: touchdown;
144146 objectName: "touchdown";
145147 anchors { fill: artShapeHolder }
146− visible: root.pressed;
148+ visible: root.pressed;
147149 radius: "medium";
148150 borderSource: "radius_pressed.sci"
149151}
tests/plugins/Dash/cardcreator/6.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618Loader {
1719 id: backgroundLoader;
1820 objectName: "backgroundLoader";
tests/plugins/Dash/cardcreator/7.res+2
@@ -13,6 +13,8 @@ AbstractButton {
1313 property bool asynchronous: true;
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
16+ enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true);
17+
1618Loader {
1719 id: backgroundLoader;
1820 objectName: "backgroundLoader";
tests/qmltests/Dash/tst_GenericScopeView.qml+33
@@ -603,6 +603,39 @@ Item {
603603 spy.wait()
604604 compare(spy.count, 1)
605605 }
606+
607+ function test_item_noninteractive() {
608+ waitForRendering(genericScopeView);
609+
610+ var categoryListView = findChild(genericScopeView, "categoryListView");
611+ waitForRendering(categoryListView);
612+
613+ var category0 = findChild(categoryListView, "dashCategory0");
614+ waitForRendering(category0);
615+
616+ var cardTool = findChild(category0, "cardTool");
617+ var cardGrid = category0.item;
618+
619+ cardTool.template["non-interactive"] = true;
620+ compare(cardGrid.cardTool.template["non-interactive"], true);
621+
622+ var item0 = findChild(cardGrid, "delegate0");
623+ waitForRendering(item0);
624+ item0.template = cardTool.template;
625+ compare(item0.template["non-interactive"], true);
626+ compare(item0.enabled, false);
627+ var touchdown = findChild(item0, "touchdown");
628+
629+ compare(touchdown.visible, false);
630+ mouseClick(item0, item0.width / 2, item0.height / 2);
631+ compare(touchdown.visible, false);
632+
633+ cardTool.template["non-interactive"] = false;
634+ compare(cardGrid.cardTool.template["non-interactive"], false);
635+ item0.template = cardTool.template;
636+ compare(item0.template["non-interactive"], false);
637+ compare(item0.enabled, true);
638+ }
606639 }
607640 }
608641}