on xenial help sign in
Move the back button to the header itself so it will be shown when the search is out too
f67baafAlbert Astals
qml/Components/PageHeader.qml+25−1
@@ -27,6 +27,9 @@ Item {
27 property ListModel searchHistory
27 property ListModel searchHistory
28 property Scope scope
28 property Scope scope
29 property alias childItem: itemContainer.children
29 property alias childItem: itemContainer.children
30+ property alias showBackButton: backButton.visible
31+
32+ signal backClicked
30
33
31 height: units.gu(8.5)
34 height: units.gu(8.5)
32 implicitHeight: units.gu(8.5)
35 implicitHeight: units.gu(8.5)
@@ -69,11 +72,32 @@ Item {
69
72
70 Behavior on contentY { NumberAnimation { duration: 200; easing.type: Easing.OutQuad } }
73 Behavior on contentY { NumberAnimation { duration: 200; easing.type: Easing.OutQuad } }
71
74
75+ MouseArea {
76+ id: backButton
77+ visible: false
78+ height: header.height
79+ y: header.contentY
80+ anchors {
81+ left: parent.left
82+ leftMargin: visible ? units.gu(2) : 0
83+ }
84+ width: visible ? image.width + units.gu(2) : 0
85+ onClicked: root.backClicked();
86+ Image {
87+ id: image
88+ anchors.centerIn: parent
89+ source: "graphics/headerback.png"
90+ }
91+ }
92+
72 // FIXME this could potentially be simplified to avoid all the containers
93 // FIXME this could potentially be simplified to avoid all the containers
73 Item {
94 Item {
74 id: headerContainer
95 id: headerContainer
75
96
76− width: parent.width
97+ anchors {
98+ left: backButton.right
99+ right: parent.right
100+ }
77 height: childrenRect.height
101 height: childrenRect.height
78
102
79 Item {
103 Item {
qml/Dash/graphics/dashback@27.png → qml/Components/graphics/headerback@27.pngrenamed

Binary file not shown.

qml/Dash/ScopeItem.qml+16−26
@@ -45,7 +45,7 @@ Item {
45 previewListView: previewListView
45 previewListView: previewListView
46
46
47 Connections {
47 Connections {
48− target: isCurrent ? scope : null
48+ target: scopeView.isCurrent ? scope : null
49 onGotoScope: root.gotoScope(scopeId);
49 onGotoScope: root.gotoScope(scopeId);
50 onOpenScope: root.openScope(scope);
50 onOpenScope: root.openScope(scope);
51 }
51 }
@@ -58,34 +58,24 @@ Item {
58 searchHistory: root.searchHistory
58 searchHistory: root.searchHistory
59 scope: root.scope
59 scope: root.scope
60 height: units.gu(7)
60 height: units.gu(7)
61+ showBackButton: true
62+ onBackClicked: root.back();
61
63
62− childItem: Row {
64+ childItem: Label {
65+ id: label
63 anchors {
66 anchors {
64− fill: parent
67+ left: parent.left
65− leftMargin: units.gu(2)
68+ right: parent.right
66− }
67− MouseArea {
68− height: parent.height
69− width: childrenRect.width + units.gu(1)
70− onClicked: root.back();
71− Image {
72− anchors.centerIn: parent
73− source: "graphics/dashback.png"
74− }
75− }
76− Label {
77− id: label
78− anchors.verticalCenter: parent.verticalCenter
69+ verticalCenter: parent.verticalCenter
79−
80− text: scope ? scope.name : ""
81− color: "grey"
82− font.family: "Ubuntu"
83− font.weight: Font.Light
84− fontSize: "x-large"
85− elide: Text.ElideRight
86− style: Text.Raised
87− styleColor: "black"
88 }
70 }
71+ text: scope ? scope.name : ""
72+ color: "grey"
73+ font.family: "Ubuntu"
74+ font.weight: Font.Light
75+ fontSize: "x-large"
76+ elide: Text.ElideRight
77+ style: Text.Raised
78+ styleColor: "black"
89 }
79 }
90 }
80 }
91 }
81 }