on xenial help sign in
Make tryVerticalJournal, tryHorizontalJournal and tryOrganicGrid work again
commit9d7ac18590db17308326972ffa5d35c969c25900 authorAlbert Astals <albert.astals@canonical.com> dateFri 6 Jun 2014, 11:38 (12 years ago) parent4c9ae775743a90
3 files changed+68−6
tests/plugins/Dash/horizontaljournaltry.qml+23−2 tests/plugins/Dash/organicgridtry.qml+22−2 tests/plugins/Dash/verticaljournaltry.qml+23−2
tests/plugins/Dash/horizontaljournaltry.qml+23−2
@@ -29,14 +29,35 @@ Item {
2929 width: parent.width - controls.width
3030
3131 delegate: HorizontalJournal {
32+ id: hj
3233 model: vjModel
3334 rowHeight: 100
3435 columnSpacing: 10
3536 rowSpacing: 10
3637 width: parent.width
3738 height: implicitHeight > 100 ? implicitHeight : 100
38− delegateCreationBegin: lvwph.contentY
39− delegateCreationEnd: lvwph.contentY + lvwph.height
39+ displayMarginBeginning: {
40+ if (hj.y + hj.height <= 0) {
41+ // Not visible (item at top of the list viewport)
42+ return -hj.height;
43+ } else if (hj.y >= lvwph.height) {
44+ // Not visible (item at bottom of the list viewport)
45+ return 0;
46+ } else {
47+ return -Math.max(-hj.y, 0);
48+ }
49+ }
50+ displayMarginEnd: {
51+ if (hj.y + hj.height <= 0) {
52+ // Not visible (item at top of the list viewport)
53+ return 0;
54+ } else if (hj.y >= lvwph.height) {
55+ // Not visible (item at bottom of the list viewport)
56+ return -hj.height;
57+ } else {
58+ return -Math.max(hj.height - lvwph.height + hj.y, 0)
59+ }
60+ }
4061
4162 delegate: Rectangle {
4263 height: 100
tests/plugins/Dash/organicgridtry.qml+22−2
@@ -37,8 +37,28 @@ Item {
3737 rowSpacing: 10
3838 width: parent.width
3939 height: implicitHeight > 100 ? implicitHeight : 100
40− delegateCreationBegin: lvwph.contentY
41− delegateCreationEnd: lvwph.contentY + lvwph.height
40+ displayMarginBeginning: {
41+ if (grid.y + grid.height <= 0) {
42+ // Not visible (item at top of the list viewport)
43+ return -grid.height;
44+ } else if (grid.y >= lvwph.height) {
45+ // Not visible (item at bottom of the list viewport)
46+ return 0;
47+ } else {
48+ return -Math.max(-grid.y, 0);
49+ }
50+ }
51+ displayMarginEnd: {
52+ if (grid.y + grid.height <= 0) {
53+ // Not visible (item at top of the list viewport)
54+ return 0;
55+ } else if (grid.y >= lvwph.height) {
56+ // Not visible (item at bottom of the list viewport)
57+ return -grid.height;
58+ } else {
59+ return -Math.max(grid.height - lvwph.height + grid.y, 0)
60+ }
61+ }
4262
4363 delegate: Rectangle {
4464 width: 100
tests/plugins/Dash/verticaljournaltry.qml+23−2
@@ -36,8 +36,29 @@ Item {
3636 rowSpacing: 10
3737 width: parent.width
3838 height: implicitHeight > 100 ? implicitHeight : 100
39− delegateCreationBegin: lvwph.contentY
40− delegateCreationEnd: lvwph.contentY + lvwph.height
39+
40+ displayMarginBeginning: {
41+ if (vj.y + vj.height <= 0) {
42+ // Not visible (item at top of the list viewport)
43+ return -vj.height;
44+ } else if (vj.y >= lvwph.height) {
45+ // Not visible (item at bottom of the list viewport)
46+ return 0;
47+ } else {
48+ return -Math.max(-vj.y, 0);
49+ }
50+ }
51+ displayMarginEnd: {
52+ if (vj.y + vj.height <= 0) {
53+ // Not visible (item at top of the list viewport)
54+ return 0;
55+ } else if (vj.y >= lvwph.height) {
56+ // Not visible (item at bottom of the list viewport)
57+ return -vj.height;
58+ } else {
59+ return -Math.max(vj.height - lvwph.height + vj.y, 0)
60+ }
61+ }
4162
4263 delegate: Rectangle {
4364 width: 100