on xenial help sign in
Move to work on GenericScopeView.qml

And not on the Dash*.qml files

commit203cf6952d03615ed203f2485210ff32c9b89b04 authorAlbert Astals <albert.astals@canonical.com> dateMon 5 Aug 2013, 17:02 (13 years ago) parent035d9de
5 files changed+29−21
Components/Tile.qml−6 Dash/Apps/ApplicationsFilterGrid.qml+1 Dash/DashApps.qml+13−14 Dash/Generic/GenericFilterGrid.qml−1 Dash/GenericScopeView.qml+15
Components/Tile.qml−6
@@ -84,10 +84,4 @@ AbstractButton {
8484 horizontalAlignment: Text.AlignHCenter
8585 }
8686 }
87−
88− GridView.onRemove: SequentialAnimation {
89− PropertyAction { target: root; property: "GridView.delayRemove"; value: true }
90− NumberAnimation { target: root; property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.InOutQuad }
91− PropertyAction { target: root; property: "GridView.delayRemove"; value: false }
92− }
9387}
Dash/Apps/ApplicationsFilterGrid.qml+1
@@ -22,6 +22,7 @@ import "../../Components/IconUtil.js" as IconUtil
2222FilterGrid {
2323 id: filterGrid
2424
25+ filter: false
2526 minimumHorizontalSpacing: units.gu(0.5)
2627 maximumNumberOfColumns: 6
2728 delegateWidth: units.gu(11)
Dash/DashApps.qml+13−14
@@ -117,13 +117,8 @@ ScopeView {
117117 delegate: Base {
118118 id: container
119119 highlightWhenPressed: false
120− property var loader: loader
121− // Needed because of the GridView.onRemove anim in Tile.qml
122− // TODO see how can we do away without the clip (i.e. not run the animation if we are collapsing)
123− clip: true
124120
125121 Loader {
126− id: loader
127122 anchors {
128123 top: parent.top
129124 left: parent.left
@@ -143,24 +138,28 @@ ScopeView {
143138
144139 item.model = Qt.binding(function() { return categoryModels[modelName]; });
145140 item.clicked.connect(activateApplication);
146−
147141 }
148142 }
149143 }
144+
145+ ListView.onRemove: SequentialAnimation {
146+ PropertyAction {
147+ target: container; property: "ListView.delayRemove"; value: true
148+ }
149+ NumberAnimation {
150+ target: container; property: "height"; to: 0;
151+ duration: 250; easing.type: Easing.InOutQuad
152+ }
153+ PropertyAction {
154+ target: container; property: "ListView.delayRemove"; value: false
155+ }
156+ }
150157 }
151158
152159 sectionProperty: "category"
153160 sectionDelegate: Header {
154161 width: categoryView.width
155162 text: categoryListModel.getCategory(section)
156− onClicked: {
157− var obj = categoryView.item(delegateIndex)
158− if (obj && obj.loader.item.expandable) {
159− obj.loader.item.filter = !obj.loader.item.filter
160− if (!obj.loader.item.filter)
161− categoryView.maximizeVisibleArea(delegateIndex);
162− }
163− }
164163 }
165164 pageHeader: PageHeader {
166165 id: pageHeader
Dash/Generic/GenericFilterGrid.qml−1
@@ -21,7 +21,6 @@ import "../../Components/IconUtil.js" as IconUtil
2121FilterGrid {
2222 id: filtergrid
2323
24− filter: false
2524 minimumHorizontalSpacing: units.gu(0.5)
2625 delegateWidth: units.gu(11)
2726 delegateHeight: units.gu(9.5)
Dash/GenericScopeView.qml+15
@@ -56,6 +56,12 @@ ScopeView {
5656 delegate: ListItems.Base {
5757 highlightWhenPressed: false
5858
59+ function headerClicked() {
60+ if (rendererLoader.item.expandable) {
61+ rendererLoader.item.filter = !rendererLoader.item.filter;
62+ }
63+ }
64+
5965 Loader {
6066 id: rendererLoader
6167 anchors {
@@ -96,6 +102,10 @@ ScopeView {
96102 delegateItem.model.dndUri,
97103 delegateItem.model.metadata)
98104 }
105+ onFilterChanged: {
106+ if (!target.filter)
107+ categoryView.maximizeVisibleArea(index);
108+ }
99109 }
100110 }
101111 }
@@ -104,6 +114,11 @@ ScopeView {
104114 sectionDelegate: ListItems.Header {
105115 width: categoryView.width
106116 text: section
117+ onClicked: {
118+ var obj = categoryView.item(delegateIndex);
119+ if (obj)
120+ obj.headerClicked();
121+ }
107122 }
108123 pageHeader: PageHeader {
109124 id: pageHeader