on xenial help sign in
Less ugly
54a5c41Albert Astals
Dash/Apps/RunningApplicationsGrid.qml+1
@@ -23,6 +23,7 @@ ResponsiveFlowView {
23
23
24 signal updateScreenshots
24 signal updateScreenshots
25 property alias enableHeightBehavior: heightBehaviour.enabled
25 property alias enableHeightBehavior: heightBehaviour.enabled
26+ property bool enableHeightBehaviourOnNextCreation: firstModel.count + secondModel.count == 0
26
27
27 Connections {
28 Connections {
28 target: shell
29 target: shell
Dash/DashApps.qml+1−2
@@ -28,7 +28,6 @@ GenericScopeView {
28 // FIXME: a way to aggregate these models would be ideal
28 // FIXME: a way to aggregate these models would be ideal
29 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
29 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
30 property var sideStageApplicationModel: shell.applicationManager.sideStageApplications
30 property var sideStageApplicationModel: shell.applicationManager.sideStageApplications
31− property bool enableHeightBehavior: false
32
31
33 ListModel {
32 ListModel {
34 id: dummyVisibilityModifier
33 id: dummyVisibilityModifier
@@ -52,6 +51,6 @@ GenericScopeView {
52
51
53 onScopeChanged: {
52 onScopeChanged: {
54 scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
53 scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
55− enableHeightBehavior = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
54+ enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
56 }
55 }
57}
56}
Dash/GenericScopeView.qml+7−4
@@ -22,6 +22,7 @@ import "../Components/ListItems" as ListItems
22ScopeView {
22ScopeView {
23 id: scopeView
23 id: scopeView
24 readonly property alias previewShown: previewLoader.onScreen
24 readonly property alias previewShown: previewLoader.onScreen
25+ property bool enableHeightBehaviorOnNextCreation: false
25
26
26 onIsCurrentChanged: {
27 onIsCurrentChanged: {
27 pageHeader.resetSearch();
28 pageHeader.resetSearch();
@@ -85,10 +86,12 @@ ScopeView {
85 source: getRenderer(model.renderer, model.contentType)
86 source: getRenderer(model.renderer, model.contentType)
86
87
87 onLoaded: {
88 onLoaded: {
89+ if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviourOnNextCreation !== undefined) {
90+ item.enableHeightBehavior = scopeView.enableHeightBehaviorOnNextCreation;
91+ scopeView.enableHeightBehaviorOnNextCreation = false;
92+ }
88 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
93 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
89 // TODO: the running apps grid doesn't support standard scope results model yet
94 // TODO: the running apps grid doesn't support standard scope results model yet
90− item.enableHeightBehavior = enableHeightBehavior;
91− enableHeightBehavior = false;
92 item.firstModel = Qt.binding(function() { return results.firstModel })
95 item.firstModel = Qt.binding(function() { return results.firstModel })
93 item.secondModel = Qt.binding(function() { return results.secondModel })
96 item.secondModel = Qt.binding(function() { return results.secondModel })
94 } else {
97 } else {
@@ -104,8 +107,8 @@ ScopeView {
104 }
107 }
105
108
106 Component.onDestruction: {
109 Component.onDestruction: {
107− if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
110+ if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviourOnNextCreation !== undefined) {
108− enableHeightBehavior = (item.firstModel.count + item.secondModel.count == 0)
111+ scopeView.enableHeightBehaviorOnNextCreation = item.enableHeightBehaviourOnNextCreation;
109 }
112 }
110 }
113 }
111
114