Fix UI parts focus keybind and buttons

This commit is contained in:
miruka 2020-05-14 02:14:54 -04:00
parent d444c800b9
commit 45048e625c
5 changed files with 16 additions and 16 deletions

View File

@ -26,7 +26,7 @@ Rectangle {
icon.name: "go-back-to-main-pane" icon.name: "go-back-to-main-pane"
toolTip.text: qsTr("Go back to main pane") toolTip.text: qsTr("Go back to main pane")
onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() onClicked: mainUI.mainPane.toggleFocus()
Layout.preferredWidth: theme.baseElementsHeight Layout.preferredWidth: theme.baseElementsHeight
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -16,17 +16,6 @@ Rectangle {
readonly property alias filterField: filterField readonly property alias filterField: filterField
function toggleFocus() {
if (filterField.activeFocus) {
pageLoader.takeFocus()
return
}
mainPane.open()
filterField.forceActiveFocus()
}
HRowLayout { HRowLayout {
anchors.fill: parent anchors.fill: parent
@ -67,7 +56,7 @@ Rectangle {
} }
Keys.onEscapePressed: { Keys.onEscapePressed: {
mainUI.pageLoader.forceActiveFocus() mainPane.toggleFocus()
if (window.settings.clearRoomFilterOnEscape) text = "" if (window.settings.clearRoomFilterOnEscape) text = ""
} }
@ -81,7 +70,7 @@ Rectangle {
HShortcut { HShortcut {
sequences: window.settings.keys.toggleFocusMainPane sequences: window.settings.keys.toggleFocusMainPane
onActivated: toggleFocus() onActivated: mainPane.toggleFocus()
} }
} }
} }

View File

@ -15,6 +15,17 @@ HDrawer {
readonly property alias bottomBar: bottomBar readonly property alias bottomBar: bottomBar
function toggleFocus() {
if (bottomBar.filterField.activeFocus) {
pageLoader.takeFocus()
return
}
mainPane.open()
bottomBar.filterField.forceActiveFocus()
}
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
Binding on visible { Binding on visible {

View File

@ -34,7 +34,7 @@ Rectangle {
icon.name: "go-back-to-main-pane" icon.name: "go-back-to-main-pane"
toolTip.text: qsTr("Go back to main pane") toolTip.text: qsTr("Go back to main pane")
onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() onClicked: mainUI.mainPane.toggleFocus()
Layout.preferredWidth: showPaneButtons ? avatar.width : 0 Layout.preferredWidth: showPaneButtons ? avatar.width : 0
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -80,6 +80,6 @@ MultiviewPane {
HShortcut { HShortcut {
sequences: window.settings.keys.toggleFocusRoomPane sequences: window.settings.keys.toggleFocusRoomPane
onActivated: toggleFocus() onActivated: roomPane.toggleFocus()
} }
} }