From bd8bf6120e8a01147012ee401eddbed4f8a7acb2 Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Dec 2019 14:13:38 -0400 Subject: [PATCH] Fix taking focus for chat --- src/qml/Base/HPage.qml | 2 +- src/qml/Chat/Chat.qml | 3 +++ src/qml/Chat/ChatPage.qml | 4 +++- src/qml/UI.qml | 9 ++------- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qml/Base/HPage.qml b/src/qml/Base/HPage.qml index daec6620..3fcdc3d1 100644 --- a/src/qml/Base/HPage.qml +++ b/src/qml/Base/HPage.qml @@ -7,7 +7,7 @@ Page { id: innerPage - default property alias columnChildren: contentColumn.children + default property alias columnData: contentColumn.data property alias flickable: innerFlickable property alias headerLabel: innerHeaderLabel diff --git a/src/qml/Chat/Chat.qml b/src/qml/Chat/Chat.qml index b963baf0..e8ed4db7 100644 --- a/src/qml/Chat/Chat.qml +++ b/src/qml/Chat/Chat.qml @@ -6,6 +6,7 @@ import "RoomSidePane" Item { id: chat + onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus() property string userId: "" @@ -39,9 +40,11 @@ Item { HLoader { + id: loader anchors.rightMargin: roomSidePane.visibleWidth anchors.fill: parent visible: ! roomSidePane.hidden || anchors.rightMargin < width + onLoaded: if (chat.focus) item.composer.takeFocus() source: ready ? "ChatPage.qml" : "" diff --git a/src/qml/Chat/ChatPage.qml b/src/qml/Chat/ChatPage.qml index cdbb23b1..c80e9e5c 100644 --- a/src/qml/Chat/ChatPage.qml +++ b/src/qml/Chat/ChatPage.qml @@ -14,7 +14,9 @@ HPage { // The target will be our EventList, not the page itself becomeKeyboardFlickableTarget: false - Component.onCompleted: composer.takeFocus() + + readonly property alias composer: composer + RoomHeader { Layout.fillWidth: true diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 29c5157d..1e75b08f 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -63,7 +63,8 @@ Item { anchors.fill: parent anchors.leftMargin: sidePane.visibleSize visible: ! sidePane.hidden || anchors.leftMargin < width - + clip: appearAnimation.running + onLoaded: { takeFocus(); appearAnimation.start() } // onSourceChanged: if (sidePane.collapse) sidePane.close() @@ -133,12 +134,6 @@ Item { } - onStatusChanged: if (status === Loader.Ready) { - pageLoader.takeFocus() - appearAnimation.start() - } - - clip: appearAnimation.running XAnimator { id: appearAnimation target: pageLoader.item