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

View File

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

View File

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