on xenial help sign in
Replace Flickable with an Item inside DashPageHeader for headerContainer (LP: #1599235)

Approved by: Albert Astals Cid, Josh Arenson

commit1e1a30f43abd5ffaff3d4638c4c0e757a1b06442 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateWed 3 Aug 2016, 15:51 (10 years ago) parent45ea11ec3a4c56
3 files changed+48−27
qml/Dash/DashPageHeader.qml+36−20 tests/qmltests/Dash/tst_DashContent.qml+7−4 tests/qmltests/Dash/tst_DashPageHeader.qml+5−3
qml/Dash/DashPageHeader.qml+36−20
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013,2015 Canonical, Ltd.
2+ * Copyright (C) 2013,2015,2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -137,41 +137,57 @@ Item {
137137 }
138138 }
139139
140− Flickable {
140+ Item {
141141 id: headerContainer
142142 objectName: "headerContainer"
143− clip: contentY < height
144143 anchors { left: parent.left; top: parent.top; right: parent.right }
145144 height: header.__styleInstance.contentHeight
146− contentHeight: headersColumn.height
147− interactive: false
148− contentY: showSearch ? 0 : height
149145
150146 property bool showSearch: false
151147
152− Background {
153− id: background
154− objectName: "headerBackground"
155− style: scopeStyle.headerBackground
148+ state: headerContainer.showSearch ? "search" : ""
149+
150+ states: State {
151+ name: "search"
152+
153+ AnchorChanges {
154+ target: headersColumn
155+ anchors.top: parent.top
156+ anchors.bottom: undefined
157+ }
156158 }
157159
158− Behavior on contentY {
159− UbuntuNumberAnimation {
160− id: openSearchAnimation
161− property bool openPopup: false
160+ transitions: Transition {
161+ id: openSearchAnimation
162+ AnchorAnimation {
163+ duration: UbuntuAnimation.FastDuration
164+ easing: UbuntuAnimation.StandardEasing
165+ }
162166
163− onRunningChanged: {
164− if (!running && openSearchAnimation.openPopup) {
165− openSearchAnimation.openPopup = false;
166− root.openPopup();
167− }
167+ property bool openPopup: false
168+
169+ onRunningChanged: {
170+ headerContainer.clip = running;
171+ if (!running && openSearchAnimation.openPopup) {
172+ openSearchAnimation.openPopup = false;
173+ root.openPopup();
168174 }
169175 }
170176 }
171177
178+ Background {
179+ id: background
180+ objectName: "headerBackground"
181+ style: scopeStyle.headerBackground
182+ }
183+
172184 Column {
173185 id: headersColumn
174− anchors { left: parent.left; right: parent.right }
186+ anchors {
187+ left: parent.left
188+ right: parent.right
189+ bottom: parent.bottom
190+ }
175191
176192 PageHeader {
177193 id: searchHeader
tests/qmltests/Dash/tst_DashContent.qml+7−4
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright (C) 2013,2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -320,7 +320,8 @@ Item {
320320 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
321321
322322 var headerContainer = findChild(dashContentList.currentItem, "headerContainer");
323− tryCompare(headerContainer, "contentY", headerContainer.height);
323+ tryCompare(headerContainer, "clip", false);
324+ verify(headerContainer.state !== "search");
324325 mouseClick(searchButton);
325326 tryCompare(peExtraPanel, "visible", true);
326327 waitForRendering(navigationListView);
@@ -384,7 +385,8 @@ Item {
384385 mouseClick(header0);
385386 compare(peExtraPanel.visible, false);
386387
387− tryCompare(headerContainer, "contentY", headerContainer.height);
388+ tryCompare(headerContainer, "clip", false);
389+ verify(headerContainer.state !== "search");
388390 mouseClick(searchButton);
389391 tryCompare(peExtraPanel, "visible", true);
390392 tryCompare(navigationListView.currentItem.navigation, "loaded", true);
@@ -556,7 +558,8 @@ Item {
556558
557559 mouseClick(cancelButton);
558560 tryCompare(headerContainer, "showSearch", false);
559− tryCompare(headerContainer, "contentY", headerContainer.height);
561+ tryCompare(headerContainer, "clip", false);
562+ verify(headerContainer.state !== "search");
560563
561564 // test within a navigation
562565 goToSecondLevel();
tests/qmltests/Dash/tst_DashPageHeader.qml+5−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013,2015 Canonical Ltd.
2+ * Copyright (C) 2013,2015,2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -43,13 +43,15 @@ Item {
4343 property var headerContainer: findChild(pageHeader, "headerContainer")
4444
4545 function doTypeString(text) {
46− tryCompare(headerContainer, "contentY", 0);
46+ tryCompare(headerContainer, "clip", false);
47+ compare(headerContainer.state, "search");
4748 typeString(text);
4849 }
4950
5051 function doResetSearch() {
5152 pageHeader.resetSearch();
52− tryCompare(headerContainer, "contentY", headerContainer.height);
53+ tryCompare(headerContainer, "clip", false);
54+ verify(headerContainer.state !== "search");
5355 }
5456
5557 function init() {