on xenial help sign in
Add some explicit layout() calls
ff326f5Albert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+12−4
@@ -400,6 +400,7 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
400 }
400 }
401
401
402 m_previousContentY = contentY();
402 m_previousContentY = contentY();
403+ layout();
403 polish();
404 polish();
404}
405}
405
406
@@ -794,6 +795,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQuickChangeSet &changeSet, bo
794 }
795 }
795 }
796 }
796
797
798+ layout();
797 polish();
799 polish();
798 m_contentHeightDirty = true;
800 m_contentHeightDirty = true;
799}
801}
@@ -827,6 +829,7 @@ void ListViewWithPageHeader::headerHeightChanged(qreal newHeaderHeight, qreal ol
827 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight);
829 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight);
828 updateClipItem();
830 updateClipItem();
829 adjustMinYExtent();
831 adjustMinYExtent();
832+ layout();
830 qDebug() << "ListViewWithPageHeader::headerHeightChanged A" << m_minYExtent;
833 qDebug() << "ListViewWithPageHeader::headerHeightChanged A" << m_minYExtent;
831 } else {
834 } else {
832 if (oldHeaderY + oldHeaderHeight > contentY()) {
835 if (oldHeaderY + oldHeaderHeight > contentY()) {
@@ -862,11 +865,8 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::itemAtIndex(int modelI
862 return nullptr;
865 return nullptr;
863}
866}
864
867
865−void ListViewWithPageHeader::updatePolish()
868+void ListViewWithPageHeader::layout()
866{
869{
867− if (!model())
868− return;
869−
870 if (!m_visibleItems.isEmpty()) {
870 if (!m_visibleItems.isEmpty()) {
871 const qreal visibleFrom = contentY() - m_clipItem->y() + m_headerItemShownHeight;
871 const qreal visibleFrom = contentY() - m_clipItem->y() + m_headerItemShownHeight;
872 const qreal visibleTo = contentY() + height() - m_clipItem->y();
872 const qreal visibleTo = contentY() + height() - m_clipItem->y();
@@ -933,6 +933,14 @@ void ListViewWithPageHeader::updatePolish()
933 }
933 }
934 }
934 }
935 }
935 }
936+}
937+
938+void ListViewWithPageHeader::updatePolish()
939+{
940+ if (!model())
941+ return;
942+
943+ layout();
936
944
937 refill();
945 refill();
938
946
plugins/ListViewWithPageHeader/listviewwithpageheader.h+1
@@ -102,6 +102,7 @@ private:
102
102
103 void createDelegateModel();
103 void createDelegateModel();
104
104
105+ void layout();
105 void refill();
106 void refill();
106 bool addVisibleItems(qreal fillFrom, qreal fillTo, bool asynchronous);
107 bool addVisibleItems(qreal fillFrom, qreal fillTo, bool asynchronous);
107 bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);
108 bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);