on xenial help sign in
Pass down the variables to the function

otherwise doesn't get updated in changes of values that are used in the function not passed down

commit033eafa74c765f6b2fa90d77b5091c4a5d3beb9a authorAlbert Astals <albert.astals@canonical.com> dateFri 18 Jul 2014, 13:35 (12 years ago) parent7ce2be3
2 files changed+5−5
qml/Components/FilterGrid.qml+2−2 qml/Components/ResponsiveGridView.qml+3−3
qml/Components/FilterGrid.qml+2−2
@@ -39,8 +39,8 @@ Item {
3939 property int uncollapsedRowCount: Math.ceil(model.count / columns)
4040 /* Never show more rows than model would fill up. */
4141 readonly property int rowsWhenCollapsed: Math.min(collapsedRowCount, uncollapsedRowCount)
42− readonly property int collapsedHeight: iconTileGrid.contentHeightForRows(rowsWhenCollapsed)
43− readonly property int uncollapsedHeight: iconTileGrid.contentHeightForRows(uncollapsedRowCount)
42+ readonly property int collapsedHeight: iconTileGrid.contentHeightForRows(rowsWhenCollapsed, cellHeight, verticalSpacing)
43+ readonly property alias uncollapsedHeight: iconTileGrid.totalContentHeight
4444
4545 property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
4646 property alias maximumNumberOfColumns: iconTileGrid.maximumNumberOfColumns
qml/Components/ResponsiveGridView.qml+3−3
@@ -34,7 +34,7 @@ Item {
3434 readonly property int cellWidth: gridView.cellWidth
3535 readonly property int cellHeight: gridView.cellHeight
3636 readonly property int totalContentHeight: {
37− return contentHeightForRows(Math.ceil(gridView.model.count / columns))
37+ return contentHeightForRows(Math.ceil(gridView.model.count / columns), cellHeight, verticalSpacing)
3838 }
3939 property alias interactive: gridView.interactive
4040 readonly property alias flicking: gridView.flicking
@@ -46,8 +46,8 @@ Item {
4646 property alias highlightIndex: gridView.highlightIndex
4747 readonly property alias currentItem: gridView.currentItem
4848
49− function contentHeightForRows(rows) {
50− return rows * cellHeight + verticalSpacing
49+ function contentHeightForRows(rows, height, vSpacing) {
50+ return rows * height + vSpacing
5151 }
5252
5353 GridView {