on xenial help sign in
Do the enable/disable height animation in a different way
17bf1b9Albert Astals
Dash/Apps/RunningApplicationsGrid.qml+16−2
@@ -22,6 +22,7 @@ ResponsiveFlowView {
22 clip: true
22 clip: true
23
23
24 signal updateScreenshots
24 signal updateScreenshots
25+ property alias enableHeightBehavior: heightBehaviour.enabled
25
26
26 Connections {
27 Connections {
27 target: shell
28 target: shell
@@ -30,11 +31,24 @@ ResponsiveFlowView {
30 }
31 }
31
32
32 Behavior on height {
33 Behavior on height {
33− // FIXME Rethink how we pass down properties from the LVWPH to the interested parties
34+ id: heightBehaviour
34− enabled: culled === undefined || !culled;
35+ enabled: false
35 NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
36 NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
36 }
37 }
37
38
39+ Connections {
40+ target: root.firstModel
41+ onCountChanged: {
42+ heightBehaviour.enabled = true;
43+ }
44+ }
45+ Connections {
46+ target: root.secondModel
47+ onCountChanged: {
48+ heightBehaviour.enabled = true;
49+ }
50+ }
51+
38 property bool canEnableTerminationMode: true
52 property bool canEnableTerminationMode: true
39
53
40 onCanEnableTerminationModeChanged: {
54 onCanEnableTerminationModeChanged: {
Dash/DashApps.qml+2
@@ -28,6 +28,7 @@ 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
31
32
32 ListModel {
33 ListModel {
33 id: dummyVisibilityModifier
34 id: dummyVisibilityModifier
@@ -51,5 +52,6 @@ GenericScopeView {
51
52
52 onScopeChanged: {
53 onScopeChanged: {
53 scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
54 scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
55+ enableHeightBehavior = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
54 }
56 }
55}
57}
Dash/GenericScopeView.qml+12
@@ -87,6 +87,8 @@ ScopeView {
87 onLoaded: {
87 onLoaded: {
88 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
88 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
89 // TODO: the running apps grid doesn't support standard scope results model yet
89 // TODO: the running apps grid doesn't support standard scope results model yet
90+ item.enableHeightBehavior = enableHeightBehavior;
91+ enableHeightBehavior = false;
90 item.firstModel = Qt.binding(function() { return results.firstModel })
92 item.firstModel = Qt.binding(function() { return results.firstModel })
91 item.secondModel = Qt.binding(function() { return results.secondModel })
93 item.secondModel = Qt.binding(function() { return results.secondModel })
92 } else {
94 } else {
@@ -101,6 +103,16 @@ ScopeView {
101 }
103 }
102 }
104 }
103
105
106+ Component.onDestruction: {
107+ if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
108+ if (results) {
109+ enableHeightBehavior = (results.firstModel.count + results.secondModel.count == 0)
110+ } else {
111+ enableHeightBehavior = true
112+ }
113+ }
114+ }
115+
104 Connections {
116 Connections {
105 target: rendererLoader.item
117 target: rendererLoader.item
106 onClicked: {
118 onClicked: {
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp−4
@@ -139,9 +139,6 @@ void ListViewWithPageHeader::ListItem::setCulled(bool culled)
139 QQuickItemPrivate::get(m_item)->setCulled(culled);
139 QQuickItemPrivate::get(m_item)->setCulled(culled);
140 if (m_sectionItem)
140 if (m_sectionItem)
141 QQuickItemPrivate::get(m_sectionItem)->setCulled(culled);
141 QQuickItemPrivate::get(m_sectionItem)->setCulled(culled);
142−
143− QQmlContext *itemContext = QQmlEngine::contextForObject(m_item)->parentContext();
144− itemContext->setContextProperty(QLatin1String("culled"), QVariant::fromValue<bool>(culled));
145}
142}
146
143
147ListViewWithPageHeader::ListViewWithPageHeader()
144ListViewWithPageHeader::ListViewWithPageHeader()
@@ -852,7 +849,6 @@ void ListViewWithPageHeader::itemCreated(int modelIndex, QObject *object)
852 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
849 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
853 context->setContextProperty(QLatin1String("ListViewWithPageHeader"), this);
850 context->setContextProperty(QLatin1String("ListViewWithPageHeader"), this);
854 context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
851 context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
855− context->setContextProperty(QLatin1String("culled"), QVariant::fromValue<bool>(false));
856 if (modelIndex == m_asyncRequestedIndex) {
852 if (modelIndex == m_asyncRequestedIndex) {
857 createItem(modelIndex, false);
853 createItem(modelIndex, false);
858 refill();
854 refill();