Move UserAutoCompletion outside of Composer

This commit is contained in:
miruka 2020-08-21 05:39:46 -04:00
parent 4ea3a7d52a
commit 6dcc244998
3 changed files with 49 additions and 46 deletions

View File

@ -3,6 +3,7 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import "../../Base" import "../../Base"
import "AutoCompletion"
import "Banners" import "Banners"
import "Composer" import "Composer"
import "FileTransfer" import "FileTransfer"
@ -91,6 +92,14 @@ HColumnPage {
Behavior on Layout.preferredHeight { HNumberAnimation {} } Behavior on Layout.preferredHeight { HNumberAnimation {} }
} }
UserAutoCompletion {
id: userCompletion
textArea: composer.messageArea
Layout.fillWidth: true
Layout.maximumHeight: chatPage.height / 4
}
InviteBanner { InviteBanner {
id: inviteBanner id: inviteBanner
visible: ! chat.roomInfo.left && inviterId visible: ! chat.roomInfo.left && inviterId
@ -108,9 +117,9 @@ HColumnPage {
Composer { Composer {
id: composer id: composer
userCompletion: userCompletion
eventList: loadEventList ? eventListLoader.item.eventList : null eventList: loadEventList ? eventListLoader.item.eventList : null
visible: visible: ! chat.roomInfo.left && ! chat.roomInfo.inviter_id
! chat.roomInfo.left && ! chat.roomInfo.inviter_id
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumHeight: parent.height / 2 Layout.maximumHeight: parent.height / 2

View File

@ -3,30 +3,25 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import "../../../Base" import "../../../Base"
import "../AutoCompletion"
Rectangle { Rectangle {
property UserAutoCompletion userCompletion
property alias eventList: messageArea.eventList property alias eventList: messageArea.eventList
readonly property bool hasFocus: messageArea.activeFocus readonly property bool hasFocus: messageArea.activeFocus
readonly property alias messageArea: messageArea
function takeFocus() { messageArea.forceActiveFocus() } function takeFocus() { messageArea.forceActiveFocus() }
implicitHeight: Math.max(theme.baseElementsHeight, column.implicitHeight) implicitHeight: Math.max(theme.baseElementsHeight, row.implicitHeight)
color: theme.chat.composer.background color: theme.chat.composer.background
HColumnLayout { HRowLayout {
id: column id: row
anchors.fill: parent anchors.fill: parent
UserAutoCompletion {
id: userCompletion
textArea: messageArea
Layout.fillWidth: true
Layout.maximumHeight: chat.height / 3
}
HRowLayout {
HUserAvatar { HUserAvatar {
id: avatar id: avatar
radius: 0 radius: 0
@ -67,5 +62,4 @@ Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
}
} }