on xenial help sign in
Only set the source of the images once it is visible
c2a5449Albert Astals
plugins/Dash/CardCreator.js+4−2
@@ -84,7 +84,8 @@ var kArtShapeHolderCode = 'Item { \n\
84 } \n\
84 } \n\
85 image: Image { \n\
85 image: Image { \n\
86 objectName: "artImage"; \n\
86 objectName: "artImage"; \n\
87+ property bool everShown: false; \n\
87− source: cardData && cardData["art"] || ""; \n\
88+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; } \n\
88 cache: true; \n\
89 cache: true; \n\
89 asynchronous: root.asynchronous; \n\
90 asynchronous: root.asynchronous; \n\
90 fillMode: Image.PreserveAspectCrop; \n\
91 fillMode: Image.PreserveAspectCrop; \n\
@@ -195,7 +196,8 @@ var kMascotImageCode = 'Image { \n\
195 objectName: "mascotImage"; \n\
196 objectName: "mascotImage"; \n\
196 anchors { %1 } \n\
197 anchors { %1 } \n\
197 readonly property int maxSize: Math.max(width, height) * 4; \n\
198 readonly property int maxSize: Math.max(width, height) * 4; \n\
199+ property bool everShown: false; \n\
198− source: cardData && cardData["mascot"] || ""; \n\
200+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; } \n\
199 width: units.gu(6); \n\
201 width: units.gu(6); \n\
200 height: units.gu(5.625); \n\
202 height: units.gu(5.625); \n\
201 sourceSize { width: maxSize; height: maxSize } \n\
203 sourceSize { width: maxSize; height: maxSize } \n\
tests/plugins/Dash/cardcreator/1.res+2−1
@@ -46,7 +46,8 @@ Item {
46 }
46 }
47 image: Image {
47 image: Image {
48 objectName: "artImage";
48 objectName: "artImage";
49+ property bool everShown: false;
49− source: cardData && cardData["art"] || "";
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
50 cache: true;
51 cache: true;
51 asynchronous: root.asynchronous;
52 asynchronous: root.asynchronous;
52 fillMode: Image.PreserveAspectCrop;
53 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/2.res+2−1
@@ -67,7 +67,8 @@ Image {
67 objectName: "mascotImage";
67 objectName: "mascotImage";
68 anchors { verticalCenter: parent.verticalCenter; }
68 anchors { verticalCenter: parent.verticalCenter; }
69 readonly property int maxSize: Math.max(width, height) * 4;
69 readonly property int maxSize: Math.max(width, height) * 4;
70+ property bool everShown: false;
70− source: cardData && cardData["mascot"] || "";
71+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
71 width: units.gu(6);
72 width: units.gu(6);
72 height: units.gu(5.625);
73 height: units.gu(5.625);
73 sourceSize { width: maxSize; height: maxSize }
74 sourceSize { width: maxSize; height: maxSize }
tests/plugins/Dash/cardcreator/3.res+2−1
@@ -46,7 +46,8 @@ Item {
46 }
46 }
47 image: Image {
47 image: Image {
48 objectName: "artImage";
48 objectName: "artImage";
49+ property bool everShown: false;
49− source: cardData && cardData["art"] || "";
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
50 cache: true;
51 cache: true;
51 asynchronous: root.asynchronous;
52 asynchronous: root.asynchronous;
52 fillMode: Image.PreserveAspectCrop;
53 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/4.res+2−1
@@ -46,7 +46,8 @@ Loader {
46 objectName: "mascotImage";
46 objectName: "mascotImage";
47 anchors { verticalCenter: parent.verticalCenter; }
47 anchors { verticalCenter: parent.verticalCenter; }
48 readonly property int maxSize: Math.max(width, height) * 4;
48 readonly property int maxSize: Math.max(width, height) * 4;
49+ property bool everShown: false;
49− source: cardData && cardData["mascot"] || "";
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
50 width: units.gu(6);
51 width: units.gu(6);
51 height: units.gu(5.625);
52 height: units.gu(5.625);
52 sourceSize { width: maxSize; height: maxSize }
53 sourceSize { width: maxSize; height: maxSize }
tests/plugins/Dash/cardcreator/5.res+2−1
@@ -46,7 +46,8 @@ Item {
46 }
46 }
47 image: Image {
47 image: Image {
48 objectName: "artImage";
48 objectName: "artImage";
49+ property bool everShown: false;
49− source: cardData && cardData["art"] || "";
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
50 cache: true;
51 cache: true;
51 asynchronous: root.asynchronous;
52 asynchronous: root.asynchronous;
52 fillMode: Image.PreserveAspectCrop;
53 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/7.res+2−1
@@ -67,7 +67,8 @@ Image {
67 objectName: "mascotImage";
67 objectName: "mascotImage";
68 anchors { verticalCenter: parent.verticalCenter; }
68 anchors { verticalCenter: parent.verticalCenter; }
69 readonly property int maxSize: Math.max(width, height) * 4;
69 readonly property int maxSize: Math.max(width, height) * 4;
70+ property bool everShown: false;
70− source: cardData && cardData["mascot"] || "";
71+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
71 width: units.gu(6);
72 width: units.gu(6);
72 height: units.gu(5.625);
73 height: units.gu(5.625);
73 sourceSize { width: maxSize; height: maxSize }
74 sourceSize { width: maxSize; height: maxSize }