Set msg field max width using row layout

This commit is contained in:
Angela Mazzurco 2017-06-09 19:08:52 +02:00
parent ee0b347200
commit e2d430a82a

View File

@ -115,59 +115,53 @@ Item
}
TextArea
{
property var styles: StyleChat.inferiorPanel.msgComposer
RowLayout {
id: msgComposer
anchors.verticalCenter: parent.verticalCenter
anchors.left: attachButton.right
height: setTextAreaHeight()
////
//// (contentHeight > font.pixelSize)? contentHeight +font.pixelSize : parent.styles.height
width: chatView.width -
(sendButton.width + sendButton.anchors.margins) -
(attachButton.width + attachButton.anchors.margins) -
(emojiButton.width + emojiButton.anchors.margins)
placeholderText: styles.placeHolder
background: styles.background
TextArea
{
property var styles: StyleChat.inferiorPanel.msgComposer
id: msgField
wrapMode: TextEdit.Wrap
height:
(contentHeight > font.pixelSize)?
contentHeight +font.pixelSize : parent.styles.height
onTextChanged: {
if (msgComposer.length == 0)
{
sendButton.state = ""
}
else if (msgComposer.length > 0)
{
sendButton.state = "SENDBTN"
}
}
width: parent.width
function setTextAreaHeight (){
if (msgComposer.height >= chatView.height / msgComposer.styles.maxHeight)
{
return msgComposer.height
}
else if (contentHeight > font.pixelSize)
{
return msgComposer.contentHeight + msgComposer.font.pixelSize
}
else
{
return parent.styles.height
Layout.maximumHeight: chatView.height / styles.maxHeight
placeholderText: styles.placeHolder
background: styles.background
wrapMode: TextEdit.Wrap
onTextChanged: {
if (msgComposer.length == 0)
{
sendButton.state = ""
}
else if (msgComposer.length > 0)
{
sendButton.state = "SENDBTN"
}
}
}
}
BtnIcon {
id: emojiButton