Merge lp:~tpeeters/ubuntu-ui-toolkit/pageHeight into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Zsombor Egri
Approved revision: 918
Merged at revision: 918
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/pageHeight
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 100 lines (+38/-2)
3 files modified
modules/Ubuntu/Components/Page.qml (+2/-1)
modules/Ubuntu/Components/Tabs.qml (+7/-1)
tests/unit_x11/tst_components/tst_tabs.qml (+29/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/pageHeight
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+201382@code.launchpad.net

Description of the change

Fix the height of a Page in case its parent is a Loader.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
917. By Tim Peeters

empty commit

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Passed te UITK autopilot tests on device https://pastebin.canonical.com/102858/

Revision history for this message
Tim Peeters (tpeeters) wrote :

tested apps on maguro, works well with all tested apps (calendar, system-settings, gallery, dialer).

918. By Tim Peeters

clarify comment

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Looks good, nice work!!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Page.qml'
2--- modules/Ubuntu/Components/Page.qml 2014-01-09 12:00:26 +0000
3+++ modules/Ubuntu/Components/Page.qml 2014-01-13 14:54:15 +0000
4@@ -72,7 +72,8 @@
5 right: parent ? parent.right : undefined
6 bottom: parent ? parent.bottom : undefined
7 }
8- height: parent ? page.flickable ? parent.height : parent.height - internal.headerHeight : undefined
9+ // avoid using parent.height because parent may be a Loader which does not have its height set.
10+ height: parentNode ? page.flickable ? parentNode.height : parentNode.height - internal.headerHeight : undefined
11
12 /*!
13 The title of the page. Will be shown in the header of the \l MainView.
14
15=== modified file 'modules/Ubuntu/Components/Tabs.qml'
16--- modules/Ubuntu/Components/Tabs.qml 2013-12-02 18:57:32 +0000
17+++ modules/Ubuntu/Components/Tabs.qml 2014-01-13 14:54:15 +0000
18@@ -63,7 +63,11 @@
19 title: i18n.tr("External")
20 page: Loader {
21 parent: externalTab
22- anchors.fill: parent
23+ anchors {
24+ left: parent.left
25+ right: parent.right
26+ bottom: parent.bottom
27+ }
28 source: (tabs.selectedTab === externalTab) ? Qt.resolvedUrl("MyCustomPage.qml") : ""
29 }
30 }
31@@ -86,6 +90,8 @@
32
33 \endqml
34 As the example above shows, an external \l Page inside a \l Tab can be loaded using a Loader.
35+ Note that setting the top anchor or the height of the Loader would override the \l Page height.
36+ We avoid this because the \l Page automatically adapts its height to accommodate for the header.
37
38 It is possible to use a Repeater to generate tabs, but when doing so, ensure that the Repeater
39 is declared inside the Tabs at the end, because otherwise the shuffling of
40
41=== modified file 'tests/unit_x11/tst_components/tst_tabs.qml'
42--- tests/unit_x11/tst_components/tst_tabs.qml 2013-12-10 14:25:43 +0000
43+++ tests/unit_x11/tst_components/tst_tabs.qml 2014-01-13 14:54:15 +0000
44@@ -86,6 +86,20 @@
45 sourceComponent: tabs.selectedTabIndex != 5 ? null : pageComponent
46 }
47 }
48+ Tab {
49+ id: tabNoFlickLoader
50+ title: "loadNoFlick"
51+ page: Loader {
52+ id: loaderNoFlick
53+ anchors {
54+ left: parent.left
55+ right: parent.right
56+ bottom: parent.bottom
57+ }
58+ // height compes from the loaded Page
59+ sourceComponent: tabs.selectedTabIndex === 6 ? pageComponentNoFlick : null
60+ }
61+ }
62 }
63 Component {
64 id: pageComponent
65@@ -99,6 +113,12 @@
66 }
67 }
68 }
69+ Component {
70+ id: pageComponentNoFlick
71+ Page {
72+ title: "Loaded page without flickable"
73+ }
74+ }
75 }
76
77 ListModel {
78@@ -364,6 +384,14 @@
79 tabs.selectedTabIndex = 0;
80 }
81
82+ function test_pageHeightLoaderNoFlick_bug1259917() {
83+ tabs.selectedTabIndex = 6;
84+ compare(tabs.selectedTab, tabNoFlickLoader, "Tab 6 was selected.");
85+ compare(mainView.__propagated.header.flickable, null, "Loaded page without flickable.");
86+ compare(loaderNoFlick.item.height, mainView.height - mainView.__propagated.header.height,
87+ "Correct height for loaded Page without flickable.");
88+ }
89+
90 function test_index() {
91 compare(tab1.index, 0, "tab1 is at 0");
92 compare(tab2.index, 1, "tab2 is at 1");
93@@ -371,6 +399,7 @@
94 compare(tabFlick1.index, 3, "tabFlick1 is at 3");
95 compare(tabFlick2.index, 4, "tabFlick2 is at 4");
96 compare(tabFlickLoader.index, 5, "tabFlickLoader is at 5");
97+ compare(tabNoFlickLoader.index, 6, "tabNoFlickLoader is at 6");
98 }
99
100 function test_deactivateByTimeout() {

Subscribers

People subscribed via source and target branches

to status/vote changes: