on xenial help sign in
Fix some culling to make it more accurate
commit8d8d033218f1d3ccd651556663eb2e4e6b6fa8f1 authorAlbert Astals <albert.astals@canonical.com> dateWed 12 Jun 2013, 10:20 (13 years ago) parentbb95d96
2 files changed+6−6
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+5−2 tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+1−4
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+5−2
@@ -701,7 +701,7 @@ void ListViewWithPageHeader::updatePolish()
701701 return;
702702
703703 if (!m_visibleItems.isEmpty()) {
704− const qreal visibleFrom = contentY() - m_clipItem->y();
704+ const qreal visibleFrom = contentY() - m_clipItem->y() + m_headerItemShownHeight;
705705 const qreal visibleTo = contentY() + height() - m_clipItem->y();
706706
707707 qreal pos = m_visibleItems.first()->y();
@@ -720,7 +720,6 @@ void ListViewWithPageHeader::updatePolish()
720720 const QString section = m_delegateModel->stringValue(modelIndex, m_sectionProperty);
721721 QQmlContext *context = QQmlEngine::contextForObject(m_topSectionItem)->parentContext();
722722 context->setContextProperty(QLatin1String("section"), section);
723−
724723
725724 // Positing the top section sticky item is a two step process
726725 // First we set it either we cull it (because it doesn't need to be sticked to the top)
@@ -730,9 +729,13 @@ void ListViewWithPageHeader::updatePolish()
730729 const qreal topSectionStickPos = m_headerItemShownHeight + contentY() - m_clipItem->y();
731730 if (topSectionStickPos <= pos) {
732731 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
732+ QQuickItemPrivate::get(item->m_sectionItem)->setCulled(false);
733733 } else {
734734 QQuickItemPrivate::get(m_topSectionItem)->setCulled(false);
735735 m_topSectionItem->setY(topSectionStickPos);
736+ if (item->m_sectionItem) {
737+ QQuickItemPrivate::get(item->m_sectionItem)->setCulled(true);
738+ }
736739 }
737740 }
738741 }
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+1−4
@@ -1226,10 +1226,7 @@ private Q_SLOTS:
12261226 verifyItem(0, -308., 75., true);
12271227 verifyItem(1, -233., 75., true);
12281228 verifyItem(2, -158., 75., true);
1229− // TODO This is not visible culled should be true, but at the moment
1230− // we do not cull taking the clip/m_headerItemShownHeight into account
1231− // not a big thing but may be nice to fix in the future
1232− verifyItem(3, -83., 75., false);
1229+ verifyItem(3, -83., 75., true);
12331230 verifyItem(4, -8., 75., false);
12341231 verifyItem(5, 67., 75., false);
12351232 verifyItem(6, 142., 75., false);