on xenial help sign in
Do the maximizeVisibleArea animation at the same time that the unfilterIne
bb6f147Albert Astals
Dash/GenericScopeView.qml+3−5
@@ -101,11 +101,6 @@ ScopeView {
101 delegateItem.model.dndUri,
101 delegateItem.model.dndUri,
102 delegateItem.model.metadata)
102 delegateItem.model.metadata)
103 }
103 }
104− onFilterChanged: {
105− if (!target.filter) {
106− categoryView.maximizeVisibleArea(index);
107− }
108− }
109 }
104 }
110 Connections {
105 Connections {
111 target: categoryView
106 target: categoryView
@@ -122,6 +117,9 @@ ScopeView {
122 } else {
117 } else {
123 item.filter = shouldFilter;
118 item.filter = shouldFilter;
124 }
119 }
120+ if (!shouldFilter) {
121+ categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
122+ }
125 }
123 }
126 }
124 }
127 }
125 }
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+21−7
@@ -392,18 +392,32 @@ QQuickItem *ListViewWithPageHeader::item(int modelIndex) const
392bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
392bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
393{
393{
394 ListItem *listItem = itemAtIndex(modelIndex);
394 ListItem *listItem = itemAtIndex(modelIndex);
395+ return maximizeVisibleArea(listItem, listItem->height());
396+}
397+
398+bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex, int itemHeight)
399+{
400+ ListItem *listItem = itemAtIndex(modelIndex);
395− if (listItem)
401+ if (listItem) {
396− {
402+ return maximizeVisibleArea(listItem, itemHeight + (listItem->m_sectionItem ? listItem->m_sectionItem->height() : 0));
403+ }
404+
405+ return false;
406+}
407+
408+bool ListViewWithPageHeader::maximizeVisibleArea(ListItem *listItem, int listItemHeight)
409+{
410+ if (listItem) {
397 layout();
411 layout();
398 const auto listItemY = m_clipItem->y() + listItem->y();
412 const auto listItemY = m_clipItem->y() + listItem->y();
399− if (listItemY > contentY() && listItemY + listItem->height() > contentY() + height()) {
413+ if (listItemY > contentY() && listItemY + listItemHeight > contentY() + height()) {
400 // we can scroll the list up to show more stuff
414 // we can scroll the list up to show more stuff
401− const auto to = qMin(listItemY, listItemY + listItem->height() - height());
415+ const auto to = qMin(listItemY, listItemY + listItemHeight - height());
402 m_contentYAnimation->setTo(to);
416 m_contentYAnimation->setTo(to);
403 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
417 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
404 m_contentYAnimation->start();
418 m_contentYAnimation->start();
405− } else if ((listItemY < contentY() && listItemY + listItem->height() < contentY() + height()) ||
419+ } else if ((listItemY < contentY() && listItemY + listItemHeight < contentY() + height()) ||
406− (m_topSectionItem && !listItem->m_sectionItem && listItemY - m_topSectionItem->height() < contentY() && listItemY + listItem->height() < contentY() + height()))
420+ (m_topSectionItem && !listItem->m_sectionItem && listItemY - m_topSectionItem->height() < contentY() && listItemY + listItemHeight < contentY() + height()))
407 {
421 {
408 // we can scroll the list down to show more stuff
422 // we can scroll the list down to show more stuff
409 auto realVisibleListItemY = listItemY;
423 auto realVisibleListItemY = listItemY;
@@ -416,7 +430,7 @@ bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
416 realVisibleListItemY -= m_topSectionItem->height();
430 realVisibleListItemY -= m_topSectionItem->height();
417 }
431 }
418 }
432 }
419− const auto to = qMax(realVisibleListItemY, listItemY + listItem->height() - height());
433+ const auto to = qMax(realVisibleListItemY, listItemY + listItemHeight - height());
420 m_contentYAnimation->setTo(to);
434 m_contentYAnimation->setTo(to);
421 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
435 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
422 m_contentYAnimation->start();
436 m_contentYAnimation->start();
plugins/ListViewWithPageHeader/listviewwithpageheader.h+3
@@ -94,6 +94,7 @@ public:
94 // Created items are those visible and the precached ones
94 // Created items are those visible and the precached ones
95 // Returns if the item existed or not
95 // Returns if the item existed or not
96 Q_INVOKABLE bool maximizeVisibleArea(int modelIndex);
96 Q_INVOKABLE bool maximizeVisibleArea(int modelIndex);
97+ Q_INVOKABLE bool maximizeVisibleArea(int modelIndex, int itemHeight);
97
98
98Q_SIGNALS:
99Q_SIGNALS:
99 void modelChanged();
100 void modelChanged();
@@ -142,6 +143,8 @@ private:
142 QQuickItem *m_sectionItem;
143 QQuickItem *m_sectionItem;
143 };
144 };
144
145
146+ bool maximizeVisibleArea(ListItem *listItem, int listItemHeight);
147+
145 void createDelegateModel();
148 void createDelegateModel();
146
149
147 void layout();
150 void layout();