on xenial help sign in
LVWPH: Fix case in which header was shown incorrectly
3e9141fAlbert Astals Cid
plugins/Dash/listviewwithpageheader.cpp+4
@@ -587,6 +587,10 @@ void ListViewWithPageHeader::adjustHeader(qreal diff)
587 } else {
587 } else {
588 m_headerItem->setY(-m_minYExtent);
588 m_headerItem->setY(-m_minYExtent);
589 }
589 }
590+ } else if (m_headerItemShownHeight == 0 && m_previousContentY > m_headerItem->y() && contentY() < m_headerItem->y()) {
591+ // The header was hidden but now that we've moved up (e.g. because of item removed) it's visible
592+ // make sure it isn't
593+ m_headerItem->setY(-m_minYExtent);
590 }
594 }
591 Q_EMIT headerItemShownHeightChanged();
595 Q_EMIT headerItemShownHeightChanged();
592 } else {
596 } else {
tests/plugins/Dash/listviewwithpageheadertest.cpp+14
@@ -1994,6 +1994,20 @@ private Q_SLOTS:
1994 verifyItem(2, 400., 350., false);
1994 verifyItem(2, 400., 350., false);
1995 }
1995 }
1996
1996
1997+ void testRemoveItemNotShowHeader()
1998+ {
1999+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 6));
2000+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 90));
2001+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 600));
2002+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
2003+ scrollToBottom();
2004+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 2000));
2005+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
2006+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 2), Q_ARG(QVariant, 1));
2007+ QTRY_COMPARE(lvwph->m_headerItem->y(), -610.);
2008+ QTRY_COMPARE(lvwph->m_minYExtent, 610.);
2009+ }
2010+
1997private:
2011private:
1998 QQuickView *view;
2012 QQuickView *view;
1999 ListViewWithPageHeader *lvwph;
2013 ListViewWithPageHeader *lvwph;