Commit 5be1c604 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(MainWindow): close search menu if focus window is lost

parent 4a033737
...@@ -26,7 +26,7 @@ Item { ...@@ -26,7 +26,7 @@ Item {
signal menuClosed signal menuClosed
signal menuOpened signal menuOpened
function _hideMenu () { function hideMenu () {
menu.hideMenu() menu.hideMenu()
shadow.visible = false shadow.visible = false
searchField.focus = false searchField.focus = false
...@@ -35,7 +35,7 @@ Item { ...@@ -35,7 +35,7 @@ Item {
menuClosed() menuClosed()
} }
function _showMenu () { function showMenu () {
menu.showMenu() menu.showMenu()
shadow.visible = true shadow.visible = true
desktopPopup.show() desktopPopup.show()
...@@ -57,9 +57,9 @@ Item { ...@@ -57,9 +57,9 @@ Item {
font.pointSize: SearchBoxStyle.text.fontSize font.pointSize: SearchBoxStyle.text.fontSize
width: parent.width width: parent.width
Keys.onEscapePressed: _hideMenu() Keys.onEscapePressed: searchBox.hideMenu()
onActiveFocusChanged: activeFocus && _showMenu() onActiveFocusChanged: activeFocus && searchBox.showMenu()
onTextChanged: { onTextChanged: {
model.setFilterFixedString(text) model.setFilterFixedString(text)
...@@ -91,7 +91,7 @@ Item { ...@@ -91,7 +91,7 @@ Item {
popupX: coords.x popupX: coords.x
popupY: coords.y popupY: coords.y
onVisibleChanged: !visible && searchBox._hideMenu() onVisibleChanged: !visible && searchBox.hideMenu()
DropDownDynamicMenu { DropDownDynamicMenu {
id: menu id: menu
...@@ -99,7 +99,7 @@ Item { ...@@ -99,7 +99,7 @@ Item {
launcher: searchField launcher: searchField
width: searchField.width width: searchField.width
onMenuClosed: _hideMenu() onMenuClosed: searchBox.hideMenu()
ScrollableListView { ScrollableListView {
id: list id: list
......
...@@ -111,6 +111,9 @@ ApplicationWindow { ...@@ -111,6 +111,9 @@ ApplicationWindow {
} }
} }
onActiveFocusItemChanged: activeFocusItem == null &&
searchBox.hideMenu()
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
...@@ -193,12 +196,12 @@ ApplicationWindow { ...@@ -193,12 +196,12 @@ ApplicationWindow {
} }
} }
} }
// Logo. // Logo.
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 80 Layout.preferredHeight: 80
color: '#EAEAEA' color: '#EAEAEA'
//a: qsTr("ooo")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment