Merge lp:~tpeeters/ubuntu-ui-toolkit/stack-tabs into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 652
Merged at revision: 649
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/stack-tabs
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 223 lines (+141/-10)
5 files modified
modules/Ubuntu/Components/Tabs.qml (+54/-1)
tests/resources/pagestack/MyCustomPage.qml (+3/-5)
tests/resources/pagestack/PageStack.qml (+2/-2)
tests/resources/pagestack/StackWithTabs.qml (+61/-0)
tests/unit/tst_components/tst_pagestack.qml (+21/-2)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/stack-tabs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+176152@code.launchpad.net

Commit message

Allow combination of Tabs and PageStack:
- Fix header behavior for Tabs inside PageStack
- Add test for Tabs inside PageStack header bug
- Replace deprecated components in PageStack tests
- Add test program that combines PageStack and Tabs
- Update Tabs documentation

Description of the change

Allow combination of Tabs and PageStack:
- Fix header behavior for Tabs inside PageStack
- Add test for Tabs inside PageStack header bug
- Replace deprecated components in PageStack tests
- Add test program that combines PageStack and Tabs
- Update Tabs documentation

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

"Please note that when a \l PageStack exists inside Tabs, the Tabs will remain active and thus control the header, even when a new \l Page is pushed to the internal \l PageStack."

I'm wondering if that section could be a little more actionable, say "You need to push()/pop() explicitly to switch to the page in that case".

Looks good in any case. I like that the real fix is so simple.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Lovely! Thanks a lot for the doc tweaks!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Seems this is blocking on lp:~juhapekka-piiroinen/ubuntu-ui-toolkit/fix-pep8-issues getting merged first.

652. By Tim Peeters

merge trunk

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/Tabs.qml'
--- modules/Ubuntu/Components/Tabs.qml 2013-07-10 15:59:20 +0000
+++ modules/Ubuntu/Components/Tabs.qml 2013-07-25 08:32:24 +0000
@@ -91,6 +91,59 @@
91 It is possible to use a Repeater to generate tabs, but when doing so, ensure that the Repeater91 It is possible to use a Repeater to generate tabs, but when doing so, ensure that the Repeater
92 is declared inside the Tabs at the end, because otherwise the shuffling of92 is declared inside the Tabs at the end, because otherwise the shuffling of
93 the order of children by the Repeater can cause incorrect ordering of the tabs.93 the order of children by the Repeater can cause incorrect ordering of the tabs.
94
95 The \l {http://design.ubuntu.com/apps/global-patterns/navigation}{Navigation Patterns} specify that
96 a tabs header should never be combined with the back button of a \l PageStack. The only way to
97 combine Tabs and \l PageStack that avoids this is by pushing the Tabs as the first page on the
98 \l PageStack, and pushing other pages on top of that, as is shown in the following example:
99
100 \qml
101 import QtQuick 2.0
102 import Ubuntu.Components 0.1
103
104 MainView {
105 id: mainView
106 width: units.gu(38)
107 height: units.gu(50)
108
109 PageStack {
110 id: pageStack
111 Component.onCompleted: push(tabs)
112
113 Tabs {
114 id: tabs
115 Tab {
116 title: "Tab 1"
117 page: Page {
118 Button {
119 anchors.centerIn: parent
120 onClicked: pageStack.push(page3)
121 text: "Press"
122 }
123 }
124 }
125 Tab {
126 title: "Tab 2"
127 page: Page {
128 Label {
129 anchors.centerIn: parent
130 text: "Use header to navigate between tabs"
131 }
132 }
133 }
134 }
135 Page {
136 id: page3
137 visible: false
138 title: "Page on stack"
139 Label {
140 anchors.centerIn: parent
141 text: "Press back to return to the tabs"
142 }
143 }
144 }
145 }
146 \endqml
94*/147*/
95148
96PageTreeNode {149PageTreeNode {
@@ -202,7 +255,7 @@
202 target: internal.header255 target: internal.header
203 property: "contents"256 property: "contents"
204 value: tabs.active ? tabs.__headerContents : null257 value: tabs.active ? tabs.__headerContents : null
205 when: internal.header258 when: internal.header && tabs.active
206 }259 }
207260
208 style: Theme.createStyleComponent("TabsStyle.qml", tabs)261 style: Theme.createStyleComponent("TabsStyle.qml", tabs)
209262
=== modified file 'tests/resources/pagestack/MyCustomPage.qml'
--- tests/resources/pagestack/MyCustomPage.qml 2013-05-01 22:26:31 +0000
+++ tests/resources/pagestack/MyCustomPage.qml 2013-07-25 08:32:24 +0000
@@ -35,14 +35,12 @@
35 }35 }
36 }36 }
3737
38 tools: ToolbarActions {38 tools: ToolbarItems {
39 Action {39 ToolbarButton {
40 text: "action 1"40 text: "action 1"
41 iconSource: Qt.resolvedUrl("avatar_contacts_list.png")
42 }41 }
43 Action {42 ToolbarButton {
44 text: "action 2"43 text: "action 2"
45 iconSource: Qt.resolvedUrl("call_icon.png")
46 }44 }
47 opened: true45 opened: true
48 locked: true46 locked: true
4947
=== modified file 'tests/resources/pagestack/PageStack.qml'
--- tests/resources/pagestack/PageStack.qml 2013-05-02 19:18:09 +0000
+++ tests/resources/pagestack/PageStack.qml 2013-07-25 08:32:24 +0000
@@ -72,8 +72,8 @@
72 }72 }
73 }73 }
7474
75 tools: ToolbarActions {75 tools: ToolbarItems {
76 Action {76 ToolbarButton {
77 text: "oh"77 text: "oh"
78 }78 }
79 }79 }
8080
=== added file 'tests/resources/pagestack/StackWithTabs.qml'
--- tests/resources/pagestack/StackWithTabs.qml 1970-01-01 00:00:00 +0000
+++ tests/resources/pagestack/StackWithTabs.qml 2013-07-25 08:32:24 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20MainView {
21 id: mainView
22 width: units.gu(38)
23 height: units.gu(50)
24
25 PageStack {
26 id: pageStack
27 Component.onCompleted: push(tabs)
28
29 Tabs {
30 id: tabs
31 Tab {
32 title: "Tab 1"
33 page: Page {
34 Button {
35 anchors.centerIn: parent
36 onClicked: pageStack.push(page3)
37 text: "Press"
38 }
39 }
40 }
41 Tab {
42 title: "Tab 2"
43 page: Page {
44 Label {
45 anchors.centerIn: parent
46 text: "Use header to navigate between tabs"
47 }
48 }
49 }
50 }
51 Page {
52 id: page3
53 visible: false
54 title: "Page on stack"
55 Label {
56 anchors.centerIn: parent
57 text: "Press back to return to the tabs"
58 }
59 }
60 }
61}
062
=== modified file 'tests/unit/tst_components/tst_pagestack.qml'
--- tests/unit/tst_components/tst_pagestack.qml 2013-05-22 09:38:09 +0000
+++ tests/unit/tst_components/tst_pagestack.qml 2013-07-25 08:32:24 +0000
@@ -81,6 +81,21 @@
81 pageStack.clear();81 pageStack.clear();
82 }82 }
8383
84 function test_tabs_inside_stack_bug1187850() {
85 pageStack.push(tabs);
86 compare(pageStack.currentPage, tabs, "Tabs can be pushed on a PageStack");
87 compare(tabs.active, true, "Tabs on top of a PageStack are active");
88 compare(mainView.__propagated.header.contents, tabs.__headerContents, "Pushing Tabs on PageStack updates the header contents");
89 pageStack.push(page1);
90 compare(pageStack.currentPage, page1, "A page can be pushed on top of a Tabs");
91 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
92 compare(mainView.__propagated.header.contents, null, "Contents of inactive Tabs is not applied to header");
93 pageStack.pop();
94 compare(tabs.active, true, "Tabs on top of PageStack is active");
95 compare(mainView.__propagated.header.contents, tabs.__headerContents, "Active Tabs controls header contents");
96 pageStack.clear();
97 }
98
84 MainView {99 MainView {
85 id: mainView100 id: mainView
86 PageStack {101 PageStack {
@@ -90,15 +105,19 @@
90 Page {105 Page {
91 id: page1106 id: page1
92 title: "Title 1"107 title: "Title 1"
93 tools: ToolbarActions {108 tools: ToolbarItems {
94 id: tools1109 id: tools1
95 }110 }
96 }111 }
97 Page {112 Page {
98 id: page2113 id: page2
99 title: "Title 2"114 title: "Title 2"
100 tools: ToolbarActions {115 tools: ToolbarItems {
101 id: tools2116 id: tools2
102 }117 }
103 }118 }
119
120 Tabs {
121 id: tabs
122 }
104}123}

Subscribers

People subscribed via source and target branches

to status/vote changes: