@@ -30,7 +30,7 @@ Item {
31 /* If true, the number of elements displayed will be limited by collapsedRowCount.
31 /* If true, the number of elements displayed will be limited by collapsedRowCount.
32 If false, all elements will be displayed, effectively looking the same as a regular
32 If false, all elements will be displayed, effectively looking the same as a regular
33− ResponsiveGridView. */
33+ ResponsiveGridView. Manipulate this property through setFilter */
34 property bool filter: true
34 property bool filter: true
36 /* Whether, when collapsed, a button should be displayed enabling the user to expand
36 /* Whether, when collapsed, a button should be displayed enabling the user to expand
@@ -66,29 +66,35 @@ Item {
66 property alias highlightIndex: iconTileGrid.highlightIndex
66 property alias highlightIndex: iconTileGrid.highlightIndex
67 readonly property alias currentItem: iconTileGrid.currentItem
67 readonly property alias currentItem: iconTileGrid.currentItem
69− height: !filterAnimation.running ? childrenRect.height : height
69+ height: filter ? root.collapsedHeight : root.uncollapsedHeight
70 clip: filterAnimation.running
70 clip: filterAnimation.running
72− NumberAnimation {
75+ NumberAnimation {
73− property bool filterEndValue
74− id: filterAnimation
76+ id: filterAnimation
77− to: filterEndValue ? root.collapsedHeight : root.uncollapsedHeight
78− // Duration and easing here match the ListViewWithPageHeader::m_contentYAnimation
77+ // Duration and easing here match the ListViewWithPageHeader::m_contentYAnimation
79− // otherwise since both animations can run at the same time you'll get
78+ // otherwise since both animations can run at the same time you'll get
80− // some visual weirdness.
79+ // some visual weirdness.
81− duration: 200
80+ duration: 200
82− easing.type: Easing.InOutQuad
81+ easing.type: Easing.InOutQuad
83− onStopped: {
82+ onRunningChanged: {
84− root.filter = filterEndValue;
84+ limitModel.filter = root.filter;
86+ heightBehaviour.enabled = false;
88− function startFilterAnimation(filter) {
91+ function setFilter(filter, animate) {
89− filterAnimation.filterEndValue = filter
92+ heightBehaviour.enabled = animate;
90− filterAnimation.start();
93+ root.filter = filter;
94+ if (!animate || !filter) {
95+ limitModel.filter = filter;
93 ResponsiveGridView {
99 ResponsiveGridView {
94 id: iconTileGrid
100 id: iconTileGrid
@@ -104,8 +110,16 @@ Item {
104 verticalSpacing: units.gu(2)
110 verticalSpacing: units.gu(2)
106 model: LimitProxyModel {
112 model: LimitProxyModel {
114+ // We do have another filter property here because
115+ // we can't directly use filter from the root since we need to decouple
116+ // the real filtering with the animation since the closing animation
117+ // i.e. filter=false we still need to not be filtering until
118+ // t he animation finishes otherwise we hide the items when the animation
120+ property bool filter: true
107 model: root.model
121 model: root.model
108− limit: (filter && !filterAnimation.running) ? rowsWhenCollapsed * iconTileGrid.columns : -1
122+ limit: filter ? rowsWhenCollapsed * iconTileGrid.columns : -1