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 {
signal menuClosed
signal menuOpened
function _hideMenu () {
function hideMenu () {
menu.hideMenu()
shadow.visible = false
searchField.focus = false
......@@ -35,7 +35,7 @@ Item {
menuClosed()
}
function _showMenu () {
function showMenu () {
menu.showMenu()
shadow.visible = true
desktopPopup.show()
......@@ -57,9 +57,9 @@ Item {
font.pointSize: SearchBoxStyle.text.fontSize
width: parent.width
Keys.onEscapePressed: _hideMenu()
Keys.onEscapePressed: searchBox.hideMenu()
onActiveFocusChanged: activeFocus && _showMenu()
onActiveFocusChanged: activeFocus && searchBox.showMenu()
onTextChanged: {
model.setFilterFixedString(text)
......@@ -91,7 +91,7 @@ Item {
popupX: coords.x
popupY: coords.y
onVisibleChanged: !visible && searchBox._hideMenu()
onVisibleChanged: !visible && searchBox.hideMenu()
DropDownDynamicMenu {
id: menu
......@@ -99,7 +99,7 @@ Item {
launcher: searchField
width: searchField.width
onMenuClosed: _hideMenu()
onMenuClosed: searchBox.hideMenu()
ScrollableListView {
id: list
......
......@@ -111,6 +111,9 @@ ApplicationWindow {
}
}
onActiveFocusItemChanged: activeFocusItem == null &&
searchBox.hideMenu()
RowLayout {
anchors.fill: parent
spacing: 0
......@@ -193,12 +196,12 @@ ApplicationWindow {
}
}
}
// Logo.
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 80
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