on xenial help sign in
Fix resizing of items before the viewport that are not the first item moving the viewport
5de03b0Albert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+3−4
@@ -507,10 +507,9 @@ void ListViewWithPageHeader::itemGeometryChanged(QQuickItem *item, const QRectF
507 headerHeightChanged(newGeometry.height(), oldGeometry.height(), oldGeometry.y());
507 headerHeightChanged(newGeometry.height(), oldGeometry.height(), oldGeometry.y());
508 } else {
508 } else {
509 if (oldGeometry.y() + oldGeometry.height() + m_clipItem->y() < contentY() && !m_visibleItems.isEmpty()) {
509 if (oldGeometry.y() + oldGeometry.height() + m_clipItem->y() < contentY() && !m_visibleItems.isEmpty()) {
510+ QQuickItem *firstItem = m_visibleItems.first();
510− item->setY(item->y() - heightDiff);
511+ firstItem->setY(firstItem->y() - heightDiff);
511− if (m_visibleItems.first() == item) {
512− adjustMinYExtent();
512+ adjustMinYExtent();
513− }
514 }
513 }
515 }
514 }
516 polish();
515 polish();
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+37
@@ -1416,6 +1416,43 @@ private Q_SLOTS:
1416 QVERIFY(!lvwph->isAtYEnd());
1416 QVERIFY(!lvwph->isAtYEnd());
1417 }
1417 }
1418
1418
1419+ void changeSizeVisibleItemNotOnViewport()
1420+ {
1421+ changeContentY(440);
1422+
1423+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 5);
1424+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1425+ verifyItem(0, -390., 150., true);
1426+ verifyItem(1, -240., 200., true);
1427+ verifyItem(2, -40, 350., false);
1428+ verifyItem(3, 310, 350., false);
1429+ verifyItem(4, 660, 350., true);
1430+ QCOMPARE(lvwph->m_minYExtent, 0.);
1431+ QCOMPARE(lvwph->m_clipItem->y(), 440.);
1432+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1433+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1434+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1435+ QCOMPARE(lvwph->contentY(), 440.);
1436+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1437+
1438+ model->setProperty(1, "size", 100);
1439+
1440+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 5);
1441+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1442+ verifyItem(0, -290., 150., true);
1443+ verifyItem(1, -140., 100., true);
1444+ verifyItem(2, -40, 350., false);
1445+ verifyItem(3, 310, 350., false);
1446+ verifyItem(4, 660, 350., true);
1447+ QCOMPARE(lvwph->m_minYExtent, -100.);
1448+ QCOMPARE(lvwph->m_clipItem->y(), 440.);
1449+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1450+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1451+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1452+ QCOMPARE(lvwph->contentY(), 440.);
1453+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1454+ }
1455+
1419private:
1456private:
1420 QQuickView *view;
1457 QQuickView *view;
1421 ListViewWithPageHeader *lvwph;
1458 ListViewWithPageHeader *lvwph;