on xenial help sign in
isolate the buffertoratio to one single place
efc8969Albert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4−2
@@ -100,6 +100,8 @@
100#include <private/qquickanimation_p.h>
100#include <private/qquickanimation_p.h>
101// #include <private/qquickrectangle_p.h>
101// #include <private/qquickrectangle_p.h>
102
102
103+static const qreal bufferRatio = 0.5;
104+
103qreal ListViewWithPageHeader::ListItem::height() const
105qreal ListViewWithPageHeader::ListItem::height() const
104{
106{
105 return m_item->height() + (m_sectionItem ? m_sectionItem->height() : 0);
107 return m_item->height() + (m_sectionItem ? m_sectionItem->height() : 0);
@@ -323,7 +325,7 @@ void ListViewWithPageHeader::positionAtBeginning()
323 // Create the subsequent items
325 // Create the subsequent items
324 int modelIndex = 1;
326 int modelIndex = 1;
325 qreal pos = item->y() + item->height();
327 qreal pos = item->y() + item->height();
326− const qreal buffer = height() / 2;
328+ const qreal buffer = height() * bufferRatio;
327 const qreal bufferTo = height() + buffer;
329 const qreal bufferTo = height() + buffer;
328 while (modelIndex < m_delegateModel->count() && pos <= bufferTo) {
330 while (modelIndex < m_delegateModel->count() && pos <= bufferTo) {
329 if (!(item = createItem(modelIndex, false)))
331 if (!(item = createItem(modelIndex, false)))
@@ -441,7 +443,7 @@ void ListViewWithPageHeader::refill()
441 return;
443 return;
442 }
444 }
443
445
444− const qreal buffer = height() / 2;
446+ const qreal buffer = height() * bufferRatio;
445 const qreal from = contentY();
447 const qreal from = contentY();
446 const qreal to = from + height();
448 const qreal to = from + height();
447 const qreal bufferFrom = from - buffer;
449 const qreal bufferFrom = from - buffer;