on xenial help sign in
Move the 45 and 70gu to properties
790fb43Albert Astals Cid
qml/Dash/CardGrid.qml+1−1
@@ -45,7 +45,7 @@ DashRenderer {
45 ResponsiveGridView {
45 ResponsiveGridView {
46 id: grid
46 id: grid
47 anchors.fill: parent
47 anchors.fill: parent
48− minimumHorizontalSpacing: (cardTool.isAppLikeScopeAppCategory && cardTool.viewWidth >= units.gu(70)) ? units.gu(5) : units.gu(1)
48+ minimumHorizontalSpacing: (cardTool.isAppLikeScopeAppCategory && cardTool.isWideView) ? units.gu(5) : units.gu(1)
49 delegateWidth: cardTool.cardWidth
49 delegateWidth: cardTool.cardWidth
50 delegateHeight: cardTool.cardHeight
50 delegateHeight: cardTool.cardHeight
51 verticalSpacing: units.gu(1)
51 verticalSpacing: units.gu(1)
qml/Dash/CardTool.qml+13−6
@@ -98,6 +98,13 @@ Item {
98 height: 0
98 height: 0
99 clip: true
99 clip: true
100
100
101+ // We have 3 view "widths"
102+ // narrow <= 45gu
103+ // normal
104+ // wide >= 70gu
105+ readonly property bool isWideView: viewWidth >= units.gu(70)
106+ readonly property bool isNarrowView: viewWidth <= units.gu(45)
107+
101 /*!
108 /*!
102 type:real \brief Width to be enforced on the card in this configuration.
109 type:real \brief Width to be enforced on the card in this configuration.
103
110
@@ -105,8 +112,8 @@ Item {
105 */
112 */
106 readonly property real cardWidth: {
113 readonly property real cardWidth: {
107 if (isAppLikeScopeAppCategory) {
114 if (isAppLikeScopeAppCategory) {
108− if (viewWidth > units.gu(45)) {
115+ if (!isNarrowView) {
109− if (viewWidth >= units.gu(70)) {
116+ if (isWideView) {
110 return units.gu(11);
117 return units.gu(11);
111 } else {
118 } else {
112 return units.gu(10);
119 return units.gu(10);
@@ -123,16 +130,16 @@ Item {
123 if (template["card-layout"] === "horizontal") size = "large";
130 if (template["card-layout"] === "horizontal") size = "large";
124 switch (size) {
131 switch (size) {
125 case "small": {
132 case "small": {
126− if (viewWidth <= units.gu(45)) return units.gu(12);
133+ if (isNarrowView) return units.gu(12);
127 else return units.gu(14);
134 else return units.gu(14);
128 }
135 }
129 case "large": {
136 case "large": {
130− if (viewWidth >= units.gu(70)) return units.gu(42);
137+ if (isWideView) return units.gu(42);
131 else return viewWidth - units.gu(2);
138 else return viewWidth - units.gu(2);
132 }
139 }
133 }
140 }
134− if (viewWidth <= units.gu(45)) return units.gu(18);
141+ if (isNarrowView) return units.gu(18);
135− else if (viewWidth >= units.gu(70)) return units.gu(20);
142+ else if (isWideView) return units.gu(20);
136 else return units.gu(23);
143 else return units.gu(23);
137 case "carousel":
144 case "carousel":
138 case "horizontal-list":
145 case "horizontal-list":