uiux(Chat): ensure chat input gets focus when changing views and channels

Fixes #804
This commit is contained in:
Pascal Precht 2020-09-23 09:28:20 +02:00 committed by Iuri Matias
parent 2c9d042152
commit bc7b825f55
3 changed files with 19 additions and 0 deletions

View File

@ -19,6 +19,15 @@ StackLayout {
property bool isConnected: false property bool isConnected: false
property string contactToRemove: "" property string contactToRemove: ""
property var onActivated: function () {
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
}
Component.onCompleted: {
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
}
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 300 Layout.minimumWidth: 300
@ -175,6 +184,7 @@ StackLayout {
Connections { Connections {
target: chatsModel target: chatsModel
onActiveChannelChanged: { onActiveChannelChanged: {
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
suggestions.clear() suggestions.clear()
for (let i = 0; i < chatsModel.suggestionList.rowCount(); i++) { for (let i = 0; i < chatsModel.suggestionList.rowCount(); i++) {
suggestions.append({ suggestions.append({

View File

@ -9,6 +9,10 @@ SplitView {
id: chatView id: chatView
handle: SplitViewHandle {} handle: SplitViewHandle {}
property var onActivated: function () {
chatColumn.onActivated()
}
Connections { Connections {
target: applicationWindow target: applicationWindow
onSettingsLoaded: { onSettingsLoaded: {

View File

@ -191,6 +191,11 @@ RowLayout {
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillHeight: true Layout.fillHeight: true
currentIndex: tabBar.currentIndex currentIndex: tabBar.currentIndex
onCurrentIndexChanged: {
if (typeof this.children[currentIndex].onActivated === "function") {
this.children[currentIndex].onActivated()
}
}
ChatLayout { ChatLayout {
id: chatLayoutContainer id: chatLayoutContainer