on xenial help sign in
LVWPH: Fix items cut on top in the dash (or at least some instances of it)
cd1d150Albert Astals Cid
plugins/Dash/listviewwithpageheader.cpp−4
@@ -1393,10 +1393,6 @@ void ListViewWithPageHeader::updatePolish()
1393
1393
1394 m_contentHeightDirty = false;
1394 m_contentHeightDirty = false;
1395 adjustMinYExtent();
1395 adjustMinYExtent();
1396− if (contentHeight + m_minYExtent < height()) {
1397− // need this since in the previous call to adjustMinYExtent contentHeight is not set yet
1398− m_minYExtent = 0;
1399− }
1400 m_inContentHeightKeepHeaderShown = m_headerItem && m_headerItem->y() == contentY();
1396 m_inContentHeightKeepHeaderShown = m_headerItem && m_headerItem->y() == contentY();
1401 setContentHeight(contentHeight);
1397 setContentHeight(contentHeight);
1402 m_inContentHeightKeepHeaderShown = false;
1398 m_inContentHeightKeepHeaderShown = false;
tests/plugins/Dash/listviewwithpageheadertest.cpp+16
@@ -2008,6 +2008,22 @@ private Q_SLOTS:
2008 QTRY_COMPARE(lvwph->m_minYExtent, 610.);
2008 QTRY_COMPARE(lvwph->m_minYExtent, 610.);
2009 }
2009 }
2010
2010
2011+ void testRemoveItemCutContents()
2012+ {
2013+ view->rootObject()->setHeight(921);
2014+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 6));
2015+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 1000));
2016+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 1);
2017+ QTRY_COMPARE(lvwph->contentHeight(), 1050.);
2018+ scrollToBottom();
2019+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 530));
2020+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
2021+ QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
2022+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 1);
2023+ verifyItem(0, 50., 530., false);
2024+ QTRY_COMPARE(lvwph->m_minYExtent, 530.);
2025+ }
2026+
2011private:
2027private:
2012 QQuickView *view;
2028 QQuickView *view;
2013 ListViewWithPageHeader *lvwph;
2029 ListViewWithPageHeader *lvwph;