on xenial help sign in
Do not refill or layout if we are layouting
a0e1e0cAlbert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+9
@@ -145,6 +145,7 @@ ListViewWithPageHeader::ListViewWithPageHeader()
145 , m_sectionDelegate(nullptr)
145 , m_sectionDelegate(nullptr)
146 , m_topSectionItem(nullptr)
146 , m_topSectionItem(nullptr)
147 , m_forceNoClip(false)
147 , m_forceNoClip(false)
148+ , m_inLayout(false)
148{
149{
149 m_clipItem = new QQuickItem(contentItem());
150 m_clipItem = new QQuickItem(contentItem());
150// m_clipItem = new QQuickRectangle(contentItem());
151// m_clipItem = new QQuickRectangle(contentItem());
@@ -433,6 +434,9 @@ void ListViewWithPageHeader::createDelegateModel()
433
434
434void ListViewWithPageHeader::refill()
435void ListViewWithPageHeader::refill()
435{
436{
437+ if (m_inLayout) {
438+ return;
439+ }
436 if (!isComponentComplete()) {
440 if (!isComponentComplete()) {
437 return;
441 return;
438 }
442 }
@@ -921,6 +925,10 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::itemAtIndex(int modelI
921
925
922void ListViewWithPageHeader::layout()
926void ListViewWithPageHeader::layout()
923{
927{
928+ if (m_inLayout)
929+ return;
930+
931+ m_inLayout = true;
924 if (!m_visibleItems.isEmpty()) {
932 if (!m_visibleItems.isEmpty()) {
925 const qreal visibleFrom = contentY() - m_clipItem->y() + m_headerItemShownHeight;
933 const qreal visibleFrom = contentY() - m_clipItem->y() + m_headerItemShownHeight;
926 const qreal visibleTo = contentY() + height() - m_clipItem->y();
934 const qreal visibleTo = contentY() + height() - m_clipItem->y();
@@ -994,6 +1002,7 @@ void ListViewWithPageHeader::layout()
994 }
1002 }
995 }
1003 }
996 }
1004 }
1005+ m_inLayout = false;
997}
1006}
998
1007
999void ListViewWithPageHeader::updatePolish()
1008void ListViewWithPageHeader::updatePolish()
plugins/ListViewWithPageHeader/listviewwithpageheader.h+1
@@ -150,6 +150,7 @@ private:
150 QQuickItem *m_topSectionItem;
150 QQuickItem *m_topSectionItem;
151
151
152 bool m_forceNoClip;
152 bool m_forceNoClip;
153+ bool m_inLayout;
153
154
154 // Qt 5.0 doesn't like releasing the items just after itemCreated
155 // Qt 5.0 doesn't like releasing the items just after itemCreated
155 // so we delay the releasing until the next updatePolish
156 // so we delay the releasing until the next updatePolish