on xenial help sign in
More headerless category fixes
f4fa25fAlbert Astals
plugins/Dash/listviewwithpageheader.cpp+20−3
@@ -931,12 +931,17 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
931 const int visibleIndex = remove.index + i - m_firstVisibleIndex;
931 const int visibleIndex = remove.index + i - m_firstVisibleIndex;
932 if (visibleIndex >= 0 && visibleIndex < m_visibleItems.count()) {
932 if (visibleIndex >= 0 && visibleIndex < m_visibleItems.count()) {
933 ListItem *item = m_visibleItems[visibleIndex];
933 ListItem *item = m_visibleItems[visibleIndex];
934− // Pass the section item down if needed
934+ // Pass the section item down if needed i.e. has no sectionItem because
935+ // had same section string (and not because it has no section at all)
935 if (item->sectionItem() && visibleIndex + 1 < m_visibleItems.count()) {
936 if (item->sectionItem() && visibleIndex + 1 < m_visibleItems.count()) {
936 ListItem *nextItem = m_visibleItems[visibleIndex + 1];
937 ListItem *nextItem = m_visibleItems[visibleIndex + 1];
937 if (!nextItem->sectionItem()) {
938 if (!nextItem->sectionItem()) {
939+ const int modelIndex = remove.index + i;
940+ const QString section = m_delegateModel->stringValue(modelIndex, m_sectionProperty);
941+ if (!section.isEmpty()) {
938− nextItem->setSectionItem(item->sectionItem());
942+ nextItem->setSectionItem(item->sectionItem());
939− item->setSectionItem(nullptr);
943+ item->setSectionItem(nullptr);
944+ }
940 }
945 }
941 }
946 }
942 releaseItem(item);
947 releaseItem(item);
@@ -1250,6 +1255,18 @@ void ListViewWithPageHeader::layout()
1250 m_topSectionItem->setY(item->y() - m_topSectionItem->height());
1255 m_topSectionItem->setY(item->y() - m_topSectionItem->height());
1251 }
1256 }
1252 break;
1257 break;
1258+ } else {
1259+ // Is there no header because it's same section name or because has no section?
1260+ // Because it is because we have no section (header) we still have to push it up
1261+ const QString section = m_delegateModel->stringValue(firstReallyVisibleItem + 1, m_sectionProperty);
1262+ if (section.isEmpty()) {
1263+ if (m_topSectionItem->y() + m_topSectionItem->height() > item->y()) {
1264+ m_topSectionItem->setY(item->y() - m_topSectionItem->height());
1265+ QQmlContext *context = QQmlEngine::contextForObject(item->m_item)->parentContext();
1266+ context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
1267+ }
1268+ break;
1269+ }
1253 }
1270 }
1254 }
1271 }
1255 }
1272 }