on xenial help sign in
Fix grid column count.
a684e1cMichał Karnicki
qml/Components/ResponsiveGridView.qml+1−1
@@ -72,7 +72,7 @@ Item {
72
72
73 function columnsForSpacing(spacing) {
73 function columnsForSpacing(spacing) {
74 // minimum margin is half of the spacing
74 // minimum margin is half of the spacing
75− return Math.max(1, Math.floor((parent.width - spacing/2) / (delegateWidth + spacing)));
75+ return Math.max(1, Math.floor(parent.width / (delegateWidth + spacing)));
76 }
76 }
77
77
78 property real allocatableHorizontalSpace: parent.width - columns * delegateWidth
78 property real allocatableHorizontalSpace: parent.width - columns * delegateWidth
tests/qmltests/Components/tst_ResponsiveGridView.qml+1−1
@@ -152,7 +152,7 @@ Item {
152 var data = new Array()
152 var data = new Array()
153
153
154 data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
154 data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
155− data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
155+ data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 10})
156 data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
156 data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
157 data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
157 data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
158
158