on xenial help sign in
Added popoverShouldClose. Only set popoverShouldOpen/Close=true during state change.
e0d193fNick Dedekind
Components/PageHeader.qml+8−3
@@ -113,6 +113,7 @@ Item {
113
113
114 visible: searchEntryEnabled
114 visible: searchEntryEnabled
115 property bool popoverShouldOpen: false
115 property bool popoverShouldOpen: false
116+ property bool popoverShouldClose: false
116
117
117 property bool narrowMode: parent.width < label.contentWidth + units.gu(50)
118 property bool narrowMode: parent.width < label.contentWidth + units.gu(50)
118
119
@@ -131,8 +132,10 @@ Item {
131 onStateChanged: {
132 onStateChanged: {
132 if (state == "active" || state == "narrowActive") {
133 if (state == "active" || state == "narrowActive") {
133 popoverShouldOpen = true;
134 popoverShouldOpen = true;
135+ popoverShouldClose = false;
134 } else {
136 } else {
135 popoverShouldOpen = false;
137 popoverShouldOpen = false;
138+ popoverShouldClose = true;
136 }
139 }
137 }
140 }
138
141
@@ -146,7 +149,8 @@ Item {
146 }
149 }
147 )
150 )
148 }
151 }
149− popoverShouldOpen = true;
152+ popoverShouldOpen = false;
153+ popoverShouldClose = false;
150 }
154 }
151
155
152 function closePopover() {
156 function closePopover() {
@@ -155,6 +159,7 @@ Item {
155 searchContainer.popover = null;
159 searchContainer.popover = null;
156 }
160 }
157 popoverShouldOpen = false;
161 popoverShouldOpen = false;
162+ popoverShouldClose = false;
158 }
163 }
159
164
160 onActiveFocusChanged: if (!activeFocus) { searchHistory.addQuery(searchField.text) }
165 onActiveFocusChanged: if (!activeFocus) { searchHistory.addQuery(searchField.text) }
@@ -302,7 +307,7 @@ Item {
302 },
307 },
303 Transition {
308 Transition {
304 to: "inactive"
309 to: "inactive"
305− ScriptAction { script: if (!searchContainer.popoverShouldOpen) { searchContainer.closePopover(); } }
310+ ScriptAction { script: if (searchContainer.popoverShouldClose) { searchContainer.closePopover(); } }
306 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.InOutQuad }
311 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.InOutQuad }
307 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
312 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
308 },
313 },
@@ -318,7 +323,7 @@ Item {
318 },
323 },
319 Transition {
324 Transition {
320 to: "narrowInactive"
325 to: "narrowInactive"
321− ScriptAction { script: if (!searchContainer.popoverShouldOpen) { searchContainer.closePopover(); } }
326+ ScriptAction { script: if (searchContainer.popoverShouldClose) { searchContainer.closePopover(); } }
322 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.OutQuad }
327 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.OutQuad }
323 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
328 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
324 }
329 }