on xenial help sign in
LVWPH: Account for contentHeight not really being "all" of the content height
77c227cAlbert Astals Cid
plugins/Dash/listviewwithpageheader.cpp+7−2
@@ -514,6 +514,11 @@ qreal ListViewWithPageHeader::minYExtent() const
514 return m_minYExtent;
514 return m_minYExtent;
515}
515}
516
516
517+qreal ListViewWithPageHeader::maxYExtent() const
518+{
519+ return height() - contentHeight();
520+}
521+
517void ListViewWithPageHeader::componentComplete()
522void ListViewWithPageHeader::componentComplete()
518{
523{
519 if (m_delegateModel)
524 if (m_delegateModel)
@@ -1186,7 +1191,7 @@ void ListViewWithPageHeader::headerHeightChanged(qreal newHeaderHeight, qreal ol
1186
1191
1187void ListViewWithPageHeader::adjustMinYExtent()
1192void ListViewWithPageHeader::adjustMinYExtent()
1188{
1193{
1189− if (m_visibleItems.isEmpty() || contentHeight() < height()) {
1194+ if (m_visibleItems.isEmpty() || (contentHeight() + m_minYExtent < height())) {
1190 m_minYExtent = 0;
1195 m_minYExtent = 0;
1191 } else {
1196 } else {
1192 qreal nonCreatedHeight = 0;
1197 qreal nonCreatedHeight = 0;
@@ -1368,7 +1373,7 @@ void ListViewWithPageHeader::updatePolish()
1368
1373
1369 m_contentHeightDirty = false;
1374 m_contentHeightDirty = false;
1370 adjustMinYExtent();
1375 adjustMinYExtent();
1371− if (contentHeight < height()) {
1376+ if (contentHeight + m_minYExtent < height()) {
1372 // need this since in the previous call to adjustMinYExtent contentHeight is not set yet
1377 // need this since in the previous call to adjustMinYExtent contentHeight is not set yet
1373 m_minYExtent = 0;
1378 m_minYExtent = 0;
1374 }
1379 }
plugins/Dash/listviewwithpageheader.h+1
@@ -115,6 +115,7 @@ protected:
115 void componentComplete() override;
115 void componentComplete() override;
116 void viewportMoved(Qt::Orientations orient) override;
116 void viewportMoved(Qt::Orientations orient) override;
117 qreal minYExtent() const override;
117 qreal minYExtent() const override;
118+ qreal maxYExtent() const override;
118 void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
119 void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
119 void itemImplicitHeightChanged(QQuickItem *item) override;
120 void itemImplicitHeightChanged(QQuickItem *item) override;
120 void updatePolish() override;
121 void updatePolish() override;
tests/plugins/Dash/listviewwithpageheadertest.cpp+15
@@ -1977,6 +1977,21 @@ private Q_SLOTS:
1977 verifyItem(0, 50., 200., false);
1977 verifyItem(0, 50., 200., false);
1978 }
1978 }
1979
1979
1980+ void testBug1569976()
1981+ {
1982+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 3));
1983+
1984+ for (int i = 0; i < 10; ++i) {
1985+ scrollToBottom();
1986+ lvwph->showHeader();
1987+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1988+ scrollToTop();
1989+ }
1990+ verifyItem(0, 50., 150., false);
1991+ verifyItem(1, 200., 200., false);
1992+ verifyItem(2, 400., 350., false);
1993+ }
1994+
1980private:
1995private:
1981 QQuickView *view;
1996 QQuickView *view;
1982 ListViewWithPageHeader *lvwph;
1997 ListViewWithPageHeader *lvwph;