Fix taking focus for chat

This commit is contained in:
miruka 2019-12-09 14:13:38 -04:00
parent 2e780d7c6a
commit bd8bf6120e
4 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ Page {
id: innerPage id: innerPage
default property alias columnChildren: contentColumn.children default property alias columnData: contentColumn.data
property alias flickable: innerFlickable property alias flickable: innerFlickable
property alias headerLabel: innerHeaderLabel property alias headerLabel: innerHeaderLabel

View File

@ -6,6 +6,7 @@ import "RoomSidePane"
Item { Item {
id: chat id: chat
onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus()
property string userId: "" property string userId: ""
@ -39,9 +40,11 @@ Item {
HLoader { HLoader {
id: loader
anchors.rightMargin: roomSidePane.visibleWidth anchors.rightMargin: roomSidePane.visibleWidth
anchors.fill: parent anchors.fill: parent
visible: ! roomSidePane.hidden || anchors.rightMargin < width visible: ! roomSidePane.hidden || anchors.rightMargin < width
onLoaded: if (chat.focus) item.composer.takeFocus()
source: ready ? "ChatPage.qml" : "" source: ready ? "ChatPage.qml" : ""

View File

@ -14,7 +14,9 @@ HPage {
// The target will be our EventList, not the page itself // The target will be our EventList, not the page itself
becomeKeyboardFlickableTarget: false becomeKeyboardFlickableTarget: false
Component.onCompleted: composer.takeFocus()
readonly property alias composer: composer
RoomHeader { RoomHeader {
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -63,7 +63,8 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: sidePane.visibleSize anchors.leftMargin: sidePane.visibleSize
visible: ! sidePane.hidden || anchors.leftMargin < width visible: ! sidePane.hidden || anchors.leftMargin < width
clip: appearAnimation.running
onLoaded: { takeFocus(); appearAnimation.start() }
// onSourceChanged: if (sidePane.collapse) sidePane.close() // onSourceChanged: if (sidePane.collapse) sidePane.close()
@ -133,12 +134,6 @@ Item {
} }
onStatusChanged: if (status === Loader.Ready) {
pageLoader.takeFocus()
appearAnimation.start()
}
clip: appearAnimation.running
XAnimator { XAnimator {
id: appearAnimation id: appearAnimation
target: pageLoader.item target: pageLoader.item