on xenial help sign in
Make gradients not break FilterGrid.
commitbab628f8933513ddde88e41e39642e1ba0cbd1c0 authorMichał Karnicki <michal.karnicki@canonical.com> dateSat 22 Feb 2014, 12:49 (13 years ago) parent0d50483
2 files changed+37−27
qml/Dash/DashRenderer.qml+34 qml/Dash/GenericScopeView.qml+3−27
qml/Dash/DashRenderer.qml+34
@@ -62,4 +62,38 @@ Item {
6262
6363 function startFilterAnimation(filter) {
6464 }
65+
66+ /// Whether this is the first item in the list
67+ property bool firstItem: false
68+
69+ /// Whether this is the last item in the list
70+ property bool lastItem: false
71+
72+ Component.onCompleted: console.log(firstItem, lastItem)
73+ onFirstItemChanged: console.log(firstItem, lastItem)
74+ onLastItemChanged: console.log(firstItem, lastItem)
75+
76+ Image {
77+ visible: !firstItem
78+ anchors {
79+ top: parent.top
80+ left: parent.left
81+ right: parent.right
82+ }
83+ fillMode: Image.Stretch
84+ source: "graphics/dash_divider_top_lightgrad.png"
85+ z: -1
86+ }
87+
88+ Image {
89+ visible: !lastItem
90+ anchors {
91+ bottom: parent.bottom
92+ left: parent.left
93+ right: parent.right
94+ }
95+ fillMode: Image.Stretch
96+ source: "graphics/dash_divider_top_darkgrad.png"
97+ z: -1
98+ }
6599}
qml/Dash/GenericScopeView.qml+3−27
@@ -143,20 +143,6 @@ FocusScope {
143143 readonly property string category: categoryId
144144 readonly property var item: rendererLoader.item
145145
146− Image {
147− id: bottomGradient
148− visible: index == list.count - 1
149− anchors {
150− bottom: parent.bottom
151− left: parent.left
152− right: parent.right
153− }
154− fillMode: Image.Stretch
155− verticalAlignment: Image.AlignBottom
156− source: "graphics/dash_divider_top_darkgrad.png"
157− z: -1
158− }
159−
160146 Loader {
161147 id: rendererLoader
162148 anchors {
@@ -168,6 +154,9 @@ FocusScope {
168154 source: getRenderer(model.renderer, model.contentType, model.rendererHint, results)
169155
170156 onLoaded: {
157+ item.firstItem = Qt.binding(function() { return index === 0 });
158+ // FIXME Should not rely on count field of model, SortfilterProxyModel in this case.
159+ item.lastItem = Qt.binding(function() { return index === categoryView.model.count - 1 });
171160 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
172161 item.enableHeightBehavior = scopeView.enableHeightBehaviorOnNextCreation;
173162 scopeView.enableHeightBehaviorOnNextCreation = false;
@@ -316,19 +305,6 @@ FocusScope {
316305 else
317306 categoryView.expandedCategoryId = "";
318307 }
319−
320− Image {
321− id: topGradient
322− anchors {
323− top: parent.top
324− left: parent.left
325− right: parent.right
326− }
327− fillMode: Image.Stretch
328− verticalAlignment: Image.AlignTop
329− source: "graphics/dash_divider_top_lightgrad.png"
330− z: -1
331− }
332308 }
333309 pageHeader: Item {
334310 implicitHeight: scopeView.tabBarHeight