on xenial help sign in
No need to adjust Y on index change if there's just one row
21cec27Albert Astals
Components/FilterGrid.qml+2−1
@@ -41,11 +41,12 @@ Item {
41
41
42 /* Maximum number of rows to be show when filter=true. */
42 /* Maximum number of rows to be show when filter=true. */
43 property int collapsedRowCount: 2
43 property int collapsedRowCount: 2
44+ property int uncollapsedRowCount: Math.ceil(model.count / columns)
44 readonly property int collapsedHeight: {
45 readonly property int collapsedHeight: {
45 return iconTileGrid.contentHeightForRows(Math.min(collapsedRowCount, Math.ceil(model.count / columns)))
46 return iconTileGrid.contentHeightForRows(Math.min(collapsedRowCount, Math.ceil(model.count / columns)))
46 }
47 }
47 readonly property int uncollapsedHeight: {
48 readonly property int uncollapsedHeight: {
48− return iconTileGrid.contentHeightForRows(Math.ceil(model.count / columns))
49+ return iconTileGrid.contentHeightForRows(uncollapsedRowCount)
49 }
50 }
50
51
51 property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
52 property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
Dash/DashFilterGrid.qml+1
@@ -32,6 +32,7 @@ DashRenderer {
32 collapsedHeight: filterGrid.collapsedHeight
32 collapsedHeight: filterGrid.collapsedHeight
33 collapsedRowCount: filterGrid.collapsedRowCount
33 collapsedRowCount: filterGrid.collapsedRowCount
34 columns: filterGrid.columns
34 columns: filterGrid.columns
35+ rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
35 currentItem: filterGrid.currentItem
36 currentItem: filterGrid.currentItem
36 expandable: filterGrid.expandable
37 expandable: filterGrid.expandable
37 delegateCreationBegin: filterGrid.delegateCreationBegin
38 delegateCreationBegin: filterGrid.delegateCreationBegin
Dash/DashRenderer.qml+2
@@ -29,6 +29,8 @@ Item {
29
29
30 property int columns: 1
30 property int columns: 1
31
31
32+ property int rows: 1
33+
32 // Index of the highlighted item
34 // Index of the highlighted item
33 property int highlightIndex: -1
35 property int highlightIndex: -1
34
36
Dash/GenericScopeView.qml+20−17
@@ -447,27 +447,30 @@ FocusScope {
447 scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
447 scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
448 }
448 }
449
449
450+ // Adjust contentY in case we need to change to it to show the next row
451+ if (categoryDelegate.rows > 1) {
450− var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y; //XXX not working fine with carousel, shift in y after first
452+ var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
451
453
452− // Find new contentY and effect.postionPx
454+ // Find new contentY and effect.postionPx
453− var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
455+ var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
454
456
455− // Make sure the item is not covered by a header. Move the effect split down if necessary
457+ // Make sure the item is not covered by a header. Move the effect split down if necessary
456− var headerHeight = pageHeader.height + categoryView.stickyHeaderHeight;
458+ var headerHeight = pageHeader.height + categoryView.stickyHeaderHeight;
457− var effectAdjust = Math.max(effect.positionPx, headerHeight);
459+ var effectAdjust = Math.max(effect.positionPx, headerHeight);
458
460
459− // Make sure we don't overscroll the listview. If yes, adjust effect position
461+ // Make sure we don't overscroll the listview. If yes, adjust effect position
460− if (newContentY < 0) {
462+ if (newContentY < 0) {
461− effectAdjust += newContentY;
463+ effectAdjust += newContentY;
462− newContentY = 0;
464+ newContentY = 0;
463− }
465+ }
464− if (newContentY > Math.max(0, categoryView.contentHeight - categoryView.height)) {
466+ if (newContentY > Math.max(0, categoryView.contentHeight - categoryView.height)) {
465− effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
467+ effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
466− newContentY = categoryView.contentHeight - categoryView.height;
468+ newContentY = categoryView.contentHeight - categoryView.height;
467− }
469+ }
468
470
469− effect.positionPx = effectAdjust;
471+ effect.positionPx = effectAdjust;
470− categoryView.contentY = newContentY;
472+ categoryView.contentY = newContentY;
473+ }
471 }
474 }
472
475
473 property bool open: false
476 property bool open: false