on xenial help sign in
Replace Flickable with an Item inside DashPageHeader for headerContainer (LP: #1599235)
1e1a30fAndrea Cimitan
qml/Dash/DashPageHeader.qml+36−20
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013,2015 Canonical, Ltd.
2+ * Copyright (C) 2013,2015,2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -137,41 +137,57 @@ Item {
137 }
137 }
138 }
138 }
139
139
140− Flickable {
140+ Item {
141 id: headerContainer
141 id: headerContainer
142 objectName: "headerContainer"
142 objectName: "headerContainer"
143− clip: contentY < height
144 anchors { left: parent.left; top: parent.top; right: parent.right }
143 anchors { left: parent.left; top: parent.top; right: parent.right }
145 height: header.__styleInstance.contentHeight
144 height: header.__styleInstance.contentHeight
146− contentHeight: headersColumn.height
147− interactive: false
148− contentY: showSearch ? 0 : height
149
145
150 property bool showSearch: false
146 property bool showSearch: false
151
147
152− Background {
148+ state: headerContainer.showSearch ? "search" : ""
153− id: background
149+
154− objectName: "headerBackground"
150+ states: State {
155− style: scopeStyle.headerBackground
151+ name: "search"
152+
153+ AnchorChanges {
154+ target: headersColumn
155+ anchors.top: parent.top
156+ anchors.bottom: undefined
157+ }
156 }
158 }
157
159
158− Behavior on contentY {
160+ transitions: Transition {
159− UbuntuNumberAnimation {
160− id: openSearchAnimation
161+ id: openSearchAnimation
161− property bool openPopup: false
162+ AnchorAnimation {
163+ duration: UbuntuAnimation.FastDuration
164+ easing: UbuntuAnimation.StandardEasing
165+ }
162
166
167+ property bool openPopup: false
168+
163− onRunningChanged: {
169+ onRunningChanged: {
170+ headerContainer.clip = running;
164− if (!running && openSearchAnimation.openPopup) {
171+ if (!running && openSearchAnimation.openPopup) {
165− openSearchAnimation.openPopup = false;
172+ openSearchAnimation.openPopup = false;
166− root.openPopup();
173+ root.openPopup();
167− }
168 }
174 }
169 }
175 }
170 }
176 }
171
177
178+ Background {
179+ id: background
180+ objectName: "headerBackground"
181+ style: scopeStyle.headerBackground
182+ }
183+
172 Column {
184 Column {
173 id: headersColumn
185 id: headersColumn
186+ anchors {
187+ left: parent.left
174− anchors { left: parent.left; right: parent.right }
188+ right: parent.right
189+ bottom: parent.bottom
190+ }
175
191
176 PageHeader {
192 PageHeader {
177 id: searchHeader
193 id: searchHeader
tests/qmltests/Dash/tst_DashContent.qml+7−4
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright (C) 2013,2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -320,7 +320,8 @@ Item {
320 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
320 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
321
321
322 var headerContainer = findChild(dashContentList.currentItem, "headerContainer");
322 var headerContainer = findChild(dashContentList.currentItem, "headerContainer");
323− tryCompare(headerContainer, "contentY", headerContainer.height);
323+ tryCompare(headerContainer, "clip", false);
324+ verify(headerContainer.state !== "search");
324 mouseClick(searchButton);
325 mouseClick(searchButton);
325 tryCompare(peExtraPanel, "visible", true);
326 tryCompare(peExtraPanel, "visible", true);
326 waitForRendering(navigationListView);
327 waitForRendering(navigationListView);
@@ -384,7 +385,8 @@ Item {
384 mouseClick(header0);
385 mouseClick(header0);
385 compare(peExtraPanel.visible, false);
386 compare(peExtraPanel.visible, false);
386
387
387− tryCompare(headerContainer, "contentY", headerContainer.height);
388+ tryCompare(headerContainer, "clip", false);
389+ verify(headerContainer.state !== "search");
388 mouseClick(searchButton);
390 mouseClick(searchButton);
389 tryCompare(peExtraPanel, "visible", true);
391 tryCompare(peExtraPanel, "visible", true);
390 tryCompare(navigationListView.currentItem.navigation, "loaded", true);
392 tryCompare(navigationListView.currentItem.navigation, "loaded", true);
@@ -556,7 +558,8 @@ Item {
556
558
557 mouseClick(cancelButton);
559 mouseClick(cancelButton);
558 tryCompare(headerContainer, "showSearch", false);
560 tryCompare(headerContainer, "showSearch", false);
559− tryCompare(headerContainer, "contentY", headerContainer.height);
561+ tryCompare(headerContainer, "clip", false);
562+ verify(headerContainer.state !== "search");
560
563
561 // test within a navigation
564 // test within a navigation
562 goToSecondLevel();
565 goToSecondLevel();
tests/qmltests/Dash/tst_DashPageHeader.qml+5−3
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013,2015 Canonical Ltd.
2+ * Copyright (C) 2013,2015,2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -43,13 +43,15 @@ Item {
43 property var headerContainer: findChild(pageHeader, "headerContainer")
43 property var headerContainer: findChild(pageHeader, "headerContainer")
44
44
45 function doTypeString(text) {
45 function doTypeString(text) {
46− tryCompare(headerContainer, "contentY", 0);
46+ tryCompare(headerContainer, "clip", false);
47+ compare(headerContainer.state, "search");
47 typeString(text);
48 typeString(text);
48 }
49 }
49
50
50 function doResetSearch() {
51 function doResetSearch() {
51 pageHeader.resetSearch();
52 pageHeader.resetSearch();
52− tryCompare(headerContainer, "contentY", headerContainer.height);
53+ tryCompare(headerContainer, "clip", false);
54+ verify(headerContainer.state !== "search");
53 }
55 }
54
56
55 function init() {
57 function init() {