on xenial help sign in
Account for contentHeight not really being "all" of the content height

m_minYExtent is also part of the content height

commitd5585fdfb4c7dc2ca0d905cbeb81b0a5b5a45a92 authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 19 Apr 2016, 15:14 (11 years ago) parentab21d91
2 files changed+17−2
plugins/Dash/listviewwithpageheader.cpp+2−2 tests/plugins/Dash/listviewwithpageheadertest.cpp+15
plugins/Dash/listviewwithpageheader.cpp+2−2
@@ -1186,7 +1186,7 @@ void ListViewWithPageHeader::headerHeightChanged(qreal newHeaderHeight, qreal ol
11861186
11871187void ListViewWithPageHeader::adjustMinYExtent()
11881188{
1189− if (m_visibleItems.isEmpty() || contentHeight() < height()) {
1189+ if (m_visibleItems.isEmpty() || (contentHeight() + m_minYExtent < height())) {
11901190 m_minYExtent = 0;
11911191 } else {
11921192 qreal nonCreatedHeight = 0;
@@ -1368,7 +1368,7 @@ void ListViewWithPageHeader::updatePolish()
13681368
13691369 m_contentHeightDirty = false;
13701370 adjustMinYExtent();
1371− if (contentHeight < height()) {
1371+ if (contentHeight + m_minYExtent < height()) {
13721372 // need this since in the previous call to adjustMinYExtent contentHeight is not set yet
13731373 m_minYExtent = 0;
13741374 }
tests/plugins/Dash/listviewwithpageheadertest.cpp+15
@@ -1977,6 +1977,21 @@ private Q_SLOTS:
19771977 verifyItem(0, 50., 200., false);
19781978 }
19791979
1980+ void testBug1569976()
1981+ {
1982+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 3));
1983+
1984+ for (int i = 0; i < 5; ++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+
19801995private:
19811996 QQuickView *view;
19821997 ListViewWithPageHeader *lvwph;