Merge lp:~aacid/unity8/headerless_category_margin into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 944
Merged at revision: 954
Proposed branch: lp:~aacid/unity8/headerless_category_margin
Merge into: lp:unity8
Diff against target: 290 lines (+58/-36)
5 files modified
plugins/Dash/listviewwithpageheader.cpp (+39/-28)
plugins/Dash/listviewwithpageheader.h (+4/-0)
qml/Dash/GenericScopeView.qml (+1/-0)
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp (+3/-3)
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp (+11/-5)
To merge this branch: bzr merge lp:~aacid/unity8/headerless_category_margin
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+222132@code.launchpad.net

Commit message

Improvements for headerless categories

LVPWH: No section name -> no header
LVPWH: New hasSectionHeader context property for delegates
GSV: Add topMargin if no hasSectionHeader

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
No

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

* Did you make sure that your branch does not contain spurious tags?
Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

* If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

It looks bigger than it is, since i made m_sectionItem private and replaced its uses with getter+setter

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?

Yup!

 * Did CI run pass? If not, please explain why.

Don't ask... Complete havoc happened via a sync from debian.

review: Approve
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
--- plugins/Dash/listviewwithpageheader.cpp 2014-04-24 14:13:21 +0000
+++ plugins/Dash/listviewwithpageheader.cpp 2014-06-05 08:44:16 +0000
@@ -138,6 +138,13 @@
138 QQuickItemPrivate::get(m_sectionItem)->setCulled(culled);138 QQuickItemPrivate::get(m_sectionItem)->setCulled(culled);
139}139}
140140
141void ListViewWithPageHeader::ListItem::setSectionItem(QQuickItem *sectionItem)
142{
143 m_sectionItem = sectionItem;
144 QQmlContext *context = QQmlEngine::contextForObject(m_item)->parentContext();
145 context->setContextProperty(QLatin1String("hasSectionHeader"), QVariant::fromValue<bool>(sectionItem != nullptr));
146}
147
141ListViewWithPageHeader::ListViewWithPageHeader()148ListViewWithPageHeader::ListViewWithPageHeader()
142 : m_delegateModel(nullptr)149 : m_delegateModel(nullptr)
143 , m_asyncRequestedIndex(-1)150 , m_asyncRequestedIndex(-1)
@@ -422,7 +429,7 @@
422429
423 ListItem *listItem = itemAtIndex(modelIndex);430 ListItem *listItem = itemAtIndex(modelIndex);
424 if (listItem) {431 if (listItem) {
425 return maximizeVisibleArea(listItem, itemHeight + (listItem->m_sectionItem ? listItem->m_sectionItem->height() : 0));432 return maximizeVisibleArea(listItem, itemHeight + (listItem->sectionItem() ? listItem->sectionItem()->height() : 0));
426 }433 }
427434
428 return false;435 return false;
@@ -440,7 +447,7 @@
440 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;447 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
441 m_contentYAnimation->start();448 m_contentYAnimation->start();
442 } else if ((listItemY < contentY() && listItemY + listItemHeight < contentY() + height()) ||449 } else if ((listItemY < contentY() && listItemY + listItemHeight < contentY() + height()) ||
443 (m_topSectionItem && !listItem->m_sectionItem && listItemY - m_topSectionItem->height() < contentY() && listItemY + listItemHeight < contentY() + height()))450 (m_topSectionItem && !listItem->sectionItem() && listItemY - m_topSectionItem->height() < contentY() && listItemY + listItemHeight < contentY() + height()))
444 {451 {
445 // we can scroll the list down to show more stuff452 // we can scroll the list down to show more stuff
446 auto realVisibleListItemY = listItemY;453 auto realVisibleListItemY = listItemY;
@@ -449,7 +456,7 @@
449 // item we have to make sure to scroll it a bit more so that it is not underlapping456 // item we have to make sure to scroll it a bit more so that it is not underlapping
450 // the top section sticky item457 // the top section sticky item
451 bool topSectionShown = !QQuickItemPrivate::get(m_topSectionItem)->culled;458 bool topSectionShown = !QQuickItemPrivate::get(m_topSectionItem)->culled;
452 if (topSectionShown && !listItem->m_sectionItem) {459 if (topSectionShown && !listItem->sectionItem()) {
453 realVisibleListItemY -= m_topSectionItem->height();460 realVisibleListItemY -= m_topSectionItem->height();
454 }461 }
455 }462 }
@@ -645,7 +652,7 @@
645 if (flags & QQmlDelegateModel::Destroyed) {652 if (flags & QQmlDelegateModel::Destroyed) {
646 item->setParentItem(nullptr);653 item->setParentItem(nullptr);
647 }654 }
648 delete listItem->m_sectionItem;655 delete listItem->sectionItem();
649 delete listItem;656 delete listItem;
650}657}
651658
@@ -672,6 +679,9 @@
672 return nullptr;679 return nullptr;
673680
674 const QString section = m_delegateModel->stringValue(modelIndex, m_sectionProperty);681 const QString section = m_delegateModel->stringValue(modelIndex, m_sectionProperty);
682 if (section.isEmpty())
683 return nullptr;
684
675 if (modelIndex > 0) {685 if (modelIndex > 0) {
676 const QString prevSection = m_delegateModel->stringValue(modelIndex - 1, m_sectionProperty);686 const QString prevSection = m_delegateModel->stringValue(modelIndex - 1, m_sectionProperty);
677 if (section == prevSection)687 if (section == prevSection)
@@ -684,8 +694,8 @@
684 // Steal the section header694 // Steal the section header
685 ListItem *nextItem = itemAtIndex(modelIndex); // Not +1 since not yet inserted into m_visibleItems695 ListItem *nextItem = itemAtIndex(modelIndex); // Not +1 since not yet inserted into m_visibleItems
686 if (nextItem) {696 if (nextItem) {
687 QQuickItem *sectionItem = nextItem->m_sectionItem;697 QQuickItem *sectionItem = nextItem->sectionItem();
688 nextItem->m_sectionItem = nullptr;698 nextItem->setSectionItem(nullptr);
689 return sectionItem;699 return sectionItem;
690 }700 }
691 }701 }
@@ -793,7 +803,7 @@
793// qDebug() << "ListViewWithPageHeader::createItem::We have the item" << modelIndex << item;803// qDebug() << "ListViewWithPageHeader::createItem::We have the item" << modelIndex << item;
794 ListItem *listItem = new ListItem;804 ListItem *listItem = new ListItem;
795 listItem->m_item = item;805 listItem->m_item = item;
796 listItem->m_sectionItem = getSectionItem(modelIndex, false /*Not yet inserted into m_visibleItems*/);806 listItem->setSectionItem(getSectionItem(modelIndex, false /*Not yet inserted into m_visibleItems*/));
797 QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Geometry);807 QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Geometry);
798 ListItem *prevItem = itemAtIndex(modelIndex - 1);808 ListItem *prevItem = itemAtIndex(modelIndex - 1);
799 bool lostItem = false; // Is an item that we requested async but because of model changes809 bool lostItem = false; // Is an item that we requested async but because of model changes
@@ -832,8 +842,8 @@
832 m_firstVisibleIndex = modelIndex;842 m_firstVisibleIndex = modelIndex;
833 polish();843 polish();
834 }844 }
835 if (listItem->m_sectionItem) {845 if (listItem->sectionItem()) {
836 QQmlContext *context = QQmlEngine::contextForObject(listItem->m_sectionItem)->parentContext();846 QQmlContext *context = QQmlEngine::contextForObject(listItem->sectionItem())->parentContext();
837 context->setContextProperty(QLatin1String("delegateIndex"), modelIndex);847 context->setContextProperty(QLatin1String("delegateIndex"), modelIndex);
838 }848 }
839 adjustMinYExtent();849 adjustMinYExtent();
@@ -861,6 +871,7 @@
861 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();871 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
862 context->setContextProperty(QLatin1String("ListViewWithPageHeader"), this);872 context->setContextProperty(QLatin1String("ListViewWithPageHeader"), this);
863 context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));873 context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
874 context->setContextProperty(QLatin1String("hasSectionHeader"), QVariant::fromValue<bool>(false));
864 if (modelIndex == m_asyncRequestedIndex) {875 if (modelIndex == m_asyncRequestedIndex) {
865 createItem(modelIndex, false);876 createItem(modelIndex, false);
866 refill();877 refill();
@@ -915,11 +926,11 @@
915 if (visibleIndex >= 0 && visibleIndex < m_visibleItems.count()) {926 if (visibleIndex >= 0 && visibleIndex < m_visibleItems.count()) {
916 ListItem *item = m_visibleItems[visibleIndex];927 ListItem *item = m_visibleItems[visibleIndex];
917 // Pass the section item down if needed928 // Pass the section item down if needed
918 if (item->m_sectionItem && visibleIndex + 1 < m_visibleItems.count()) {929 if (item->sectionItem() && visibleIndex + 1 < m_visibleItems.count()) {
919 ListItem *nextItem = m_visibleItems[visibleIndex + 1];930 ListItem *nextItem = m_visibleItems[visibleIndex + 1];
920 if (!nextItem->m_sectionItem) {931 if (!nextItem->sectionItem()) {
921 nextItem->m_sectionItem = item->m_sectionItem;932 nextItem->setSectionItem(item->sectionItem());
922 item->m_sectionItem = nullptr;933 item->setSectionItem(nullptr);
923 }934 }
924 }935 }
925 releaseItem(item);936 releaseItem(item);
@@ -982,11 +993,11 @@
982 // if we need adding a new section item993 // if we need adding a new section item
983 if (m_sectionDelegate) {994 if (m_sectionDelegate) {
984 ListItem *nextItem = itemAtIndex(modelIndex + 1);995 ListItem *nextItem = itemAtIndex(modelIndex + 1);
985 if (nextItem && !nextItem->m_sectionItem) {996 if (nextItem && !nextItem->sectionItem()) {
986 nextItem->m_sectionItem = getSectionItem(modelIndex + 1, true /* alredy inserted into m_visibleItems*/);997 nextItem->setSectionItem(getSectionItem(modelIndex + 1, true /* alredy inserted into m_visibleItems*/));
987 if (growUp && nextItem->m_sectionItem) {998 if (growUp && nextItem->sectionItem()) {
988 ListItem *firstItem = m_visibleItems.first();999 ListItem *firstItem = m_visibleItems.first();
989 firstItem->setY(firstItem->y() - nextItem->m_sectionItem->height());1000 firstItem->setY(firstItem->y() - nextItem->sectionItem()->height());
990 }1001 }
991 }1002 }
992 }1003 }
@@ -1012,8 +1023,8 @@
1012// qDebug() << "ListViewWithPageHeader::onModelUpdated Change" << change.index << change.count;1023// qDebug() << "ListViewWithPageHeader::onModelUpdated Change" << change.index << change.count;
1013 for (int i = change.index; i < change.count; ++i) {1024 for (int i = change.index; i < change.count; ++i) {
1014 ListItem *item = itemAtIndex(i);1025 ListItem *item = itemAtIndex(i);
1015 if (item && item->m_sectionItem) {1026 if (item && item->sectionItem()) {
1016 QQmlContext *context = QQmlEngine::contextForObject(item->m_sectionItem)->parentContext();1027 QQmlContext *context = QQmlEngine::contextForObject(item->sectionItem())->parentContext();
1017 const QString sectionText = m_delegateModel->stringValue(i, m_sectionProperty);1028 const QString sectionText = m_delegateModel->stringValue(i, m_sectionProperty);
1018 context->setContextProperty(QLatin1String("section"), sectionText);1029 context->setContextProperty(QLatin1String("section"), sectionText);
1019 }1030 }
@@ -1026,8 +1037,8 @@
10261037
1027 for (int i = 0; i < m_visibleItems.count(); ++i) {1038 for (int i = 0; i < m_visibleItems.count(); ++i) {
1028 ListItem *item = m_visibleItems[i];1039 ListItem *item = m_visibleItems[i];
1029 if (item->m_sectionItem) {1040 if (item->sectionItem()) {
1030 QQmlContext *context = QQmlEngine::contextForObject(item->m_sectionItem)->parentContext();1041 QQmlContext *context = QQmlEngine::contextForObject(item->sectionItem())->parentContext();
1031 context->setContextProperty(QLatin1String("delegateIndex"), m_firstVisibleIndex + i);1042 context->setContextProperty(QLatin1String("delegateIndex"), m_firstVisibleIndex + i);
1032 }1043 }
1033 }1044 }
@@ -1156,18 +1167,18 @@
1156 if (topSectionStickPos > pos) {1167 if (topSectionStickPos > pos) {
1157 showStickySectionItem = true;1168 showStickySectionItem = true;
1158 } else if (topSectionStickPos == pos) {1169 } else if (topSectionStickPos == pos) {
1159 showStickySectionItem = !item->m_sectionItem;1170 showStickySectionItem = !item->sectionItem();
1160 } else {1171 } else {
1161 showStickySectionItem = false;1172 showStickySectionItem = false;
1162 }1173 }
1163 if (!showStickySectionItem) {1174 if (!showStickySectionItem) {
1164 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);1175 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
1165 if (item->m_sectionItem) {1176 if (item->sectionItem()) {
1166 // This seems it should happen since why would we cull the top section1177 // This seems it should happen since why would we cull the top section
1167 // if the first visible item has no section header? This only happens briefly1178 // if the first visible item has no section header? This only happens briefly
1168 // when increasing the height of a list that is at the bottom, the m_topSectionItem1179 // when increasing the height of a list that is at the bottom, the m_topSectionItem
1169 // gets shown shortly in the next polish call1180 // gets shown shortly in the next polish call
1170 QQuickItemPrivate::get(item->m_sectionItem)->setCulled(false);1181 QQuickItemPrivate::get(item->sectionItem())->setCulled(false);
1171 }1182 }
1172 } else {1183 } else {
1173 // Update the top sticky section header1184 // Update the top sticky section header
@@ -1186,14 +1197,14 @@
1186 delegateIndex--;1197 delegateIndex--;
1187 }1198 }
1188 context->setContextProperty(QLatin1String("delegateIndex"), delegateIndex);1199 context->setContextProperty(QLatin1String("delegateIndex"), delegateIndex);
1189 if (item->m_sectionItem) {1200 if (item->sectionItem()) {
1190 QQuickItemPrivate::get(item->m_sectionItem)->setCulled(true);1201 QQuickItemPrivate::get(item->sectionItem())->setCulled(true);
1191 }1202 }
1192 }1203 }
1193 }1204 }
1194 }1205 }
1195 QQmlContext *context = QQmlEngine::contextForObject(item->m_item)->parentContext();1206 QQmlContext *context = QQmlEngine::contextForObject(item->m_item)->parentContext();
1196 const qreal clipFrom = visibleFrom + (!item->m_sectionItem && m_topSectionItem && !QQuickItemPrivate::get(m_topSectionItem)->culled ? m_topSectionItem->height() : 0);1207 const qreal clipFrom = visibleFrom + (!item->sectionItem() && m_topSectionItem && !QQuickItemPrivate::get(m_topSectionItem)->culled ? m_topSectionItem->height() : 0);
1197 if (!cull && pos < clipFrom) {1208 if (!cull && pos < clipFrom) {
1198 context->setContextProperty(QLatin1String("heightToClip"), clipFrom - pos);1209 context->setContextProperty(QLatin1String("heightToClip"), clipFrom - pos);
1199 } else {1210 } else {
@@ -1210,7 +1221,7 @@
1210 if (firstReallyVisibleItem >= 0) {1221 if (firstReallyVisibleItem >= 0) {
1211 for (int i = firstReallyVisibleItem - m_firstVisibleIndex + 1; i < m_visibleItems.count(); ++i) {1222 for (int i = firstReallyVisibleItem - m_firstVisibleIndex + 1; i < m_visibleItems.count(); ++i) {
1212 ListItem *item = m_visibleItems[i];1223 ListItem *item = m_visibleItems[i];
1213 if (item->m_sectionItem) {1224 if (item->sectionItem()) {
1214 if (m_topSectionItem->y() + m_topSectionItem->height() > item->y()) {1225 if (m_topSectionItem->y() + m_topSectionItem->height() > item->y()) {
1215 m_topSectionItem->setY(item->y() - m_topSectionItem->height());1226 m_topSectionItem->setY(item->y() - m_topSectionItem->height());
1216 }1227 }
12171228
=== modified file 'plugins/Dash/listviewwithpageheader.h'
--- plugins/Dash/listviewwithpageheader.h 2014-04-24 14:13:21 +0000
+++ plugins/Dash/listviewwithpageheader.h 2014-06-05 08:44:16 +0000
@@ -128,7 +128,11 @@
128 bool culled() const;128 bool culled() const;
129 void setCulled(bool culled);129 void setCulled(bool culled);
130130
131 QQuickItem *sectionItem() const { return m_sectionItem; }
132 void setSectionItem(QQuickItem *sectionItem);
133
131 QQuickItem *m_item;134 QQuickItem *m_item;
135 private:
132 QQuickItem *m_sectionItem;136 QQuickItem *m_sectionItem;
133 };137 };
134138
135139
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-05-28 07:17:08 +0000
+++ qml/Dash/GenericScopeView.qml 2014-06-05 08:44:16 +0000
@@ -141,6 +141,7 @@
141 top: parent.top141 top: parent.top
142 left: parent.left142 left: parent.left
143 right: parent.right143 right: parent.right
144 topMargin: hasSectionHeader ? 0 : units.gu(2)
144 }145 }
145146
146 source: {147 source: {
147148
=== modified file 'tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp'
--- tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp 2014-05-05 22:07:57 +0000
+++ tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp 2014-06-05 08:44:16 +0000
@@ -82,10 +82,10 @@
82 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->y(), pos);82 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->y(), pos);
83 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->height(), height);83 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->height(), height);
84 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_item)->culled, culled);84 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_item)->culled, culled);
85 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), sectionHeader);85 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
86 if (!sectionHeader.isNull()) {86 if (!sectionHeader.isNull()) {
87 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_sectionItem)->culled, sectionHeaderCulled);87 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
88 QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), lvwph->m_firstVisibleIndex + visibleIndex);88 QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
89 }89 }
90 }90 }
9191
9292
=== modified file 'tests/plugins/Dash/listviewwithpageheadersectiontest.cpp'
--- tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2014-05-05 22:07:57 +0000
+++ tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2014-06-05 08:44:16 +0000
@@ -39,10 +39,11 @@
39 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->y(), pos);39 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->y(), pos);
40 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->height(), height);40 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->height(), height);
41 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_item)->culled, culled);41 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_item)->culled, culled);
42 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), sectionHeader);42 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
43 QTRY_COMPARE(hasSectionHeaderProperty(lvwph->m_visibleItems[visibleIndex]->m_item), !sectionHeader.isNull());
43 if (!sectionHeader.isNull()) {44 if (!sectionHeader.isNull()) {
44 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_sectionItem)->culled, sectionHeaderCulled);45 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
45 QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), lvwph->m_firstVisibleIndex + visibleIndex);46 QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
46 }47 }
47 }48 }
4849
@@ -109,12 +110,17 @@
109 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);110 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
110 }111 }
111112
112 QString section(QQuickItem *item)113 bool hasSectionHeaderProperty(QQuickItem *item) const
114 {
115 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("hasSectionHeader")).toBool() : false;
116 }
117
118 QString section(QQuickItem *item) const
113 {119 {
114 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("section")).toString() : QString();120 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("section")).toString() : QString();
115 }121 }
116122
117 int sectionDelegateIndex(QQuickItem *item)123 int sectionDelegateIndex(QQuickItem *item) const
118 {124 {
119 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("delegateIndex")).toInt() : -1;125 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("delegateIndex")).toInt() : -1;
120 }126 }

Subscribers

People subscribed via source and target branches