on xenial help sign in
Merge
6c87dffAlbert Astals Cid
qml/Dash/DashNavigation.qml+26−19
@@ -52,8 +52,25 @@ Item {
52
52
53 Column {
53 Column {
54 id: headersColumn
54 id: headersColumn
55+ anchors {
55− anchors.top: parent.top
56+ top: parent.top
56− width: parent.width
57+ left: parent.left
58+ right: parent.right
59+ }
60+
61+ function pop(popsNeeded) {
62+ if (popsNeeded == 0)
63+ return;
64+ isEnteringChildren = false;
65+ navigationListView.currentIndex = navigationListView.currentIndex - popsNeeded;
66+ navigationModel.setProperty(navigationListView.currentIndex, "nullifyNavigation", false);
67+ navigationModel.remove(navigationModel.count - popsNeeded, popsNeeded);
68+
69+ popsNeeded = Math.min(headersModel.count, popsNeeded);
70+ // This is effectively deleting ourselves, so needs to be the last thing of the function
71+ headersModel.remove(headersModel.count - popsNeeded, popsNeeded);
72+ }
73+
57 Repeater {
74 Repeater {
58 model: ListModel {
75 model: ListModel {
59 id: headersModel
76 id: headersModel
@@ -71,31 +88,18 @@ Item {
71 text: headerText
88 text: headerText
72 foregroundColor: d.foregroundColor
89 foregroundColor: d.foregroundColor
73
90
74− function pop(popsNeeded) {
75− if (popsNeeded == 0)
76− return;
77− isEnteringChildren = false;
78− navigationListView.currentIndex = navigationListView.currentIndex - popsNeeded;
79− navigationModel.setProperty(navigationListView.currentIndex, "nullifyNavigation", false);
80− navigationModel.remove(navigationModel.count - popsNeeded, popsNeeded);
81−
82− popsNeeded = Math.min(headersModel.count, popsNeeded);
83− // This is effectively deleting ourselves, so needs to be the last thing of the function
84− headersModel.remove(headersModel.count - popsNeeded, popsNeeded);
85− }
86−
87 onBackClicked: {
91 onBackClicked: {
88 scope.setNavigationState(parentNavigationId);
92 scope.setNavigationState(parentNavigationId);
89
93
90 var popsNeeded = headersModel.count - index;
94 var popsNeeded = headersModel.count - index;
91− pop(popsNeeded);
95+ headersColumn.pop(popsNeeded);
92 }
96 }
93
97
94 onTextClicked: {
98 onTextClicked: {
95 scope.setNavigationState(navigationId);
99 scope.setNavigationState(navigationId);
96
100
97 var popsNeeded = headersModel.count - index - 1;
101 var popsNeeded = headersModel.count - index - 1;
98− pop(popsNeeded);
102+ headersColumn.pop(popsNeeded);
99
103
100 root.leafClicked();
104 root.leafClicked();
101 }
105 }
@@ -115,7 +119,11 @@ Item {
115 // nullifyNavigation: overrides navigationId to be null
119 // nullifyNavigation: overrides navigationId to be null
116 // This is used to "clear" the delegate when going "right" on the tree
120 // This is used to "clear" the delegate when going "right" on the tree
117 }
121 }
122+ anchors {
118− anchors.top: headersColumn.bottom
123+ top: headersColumn.bottom
124+ left: parent.left
125+ right: parent.right
126+ }
119 property int maxHeight: -1
127 property int maxHeight: -1
120 Component.onCompleted: updateMaxHeight();
128 Component.onCompleted: updateMaxHeight();
121 function updateMaxHeight()
129 function updateMaxHeight()
@@ -124,7 +132,6 @@ Item {
124 }
132 }
125 property int prevHeight: maxHeight
133 property int prevHeight: maxHeight
126 height: currentItem ? currentItem.height : maxHeight
134 height: currentItem ? currentItem.height : maxHeight
127− width: parent.width
128
135
129 onHeightChanged: {
136 onHeightChanged: {
130 if (currentItem) {
137 if (currentItem) {
qml/Dash/PageHeader.qml−1
@@ -324,7 +324,6 @@ Item {
324 ]
324 ]
325
325
326 contents: Label {
326 contents: Label {
327− objectName: "header_title_label"
328 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
327 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
329 anchors {
328 anchors {
330 left: parent.left
329 left: parent.left