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,26 +115,31 @@ Item
} }
TextArea RowLayout {
{
property var styles: StyleChat.inferiorPanel.msgComposer
id: msgComposer id: msgComposer
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: attachButton.right anchors.left: attachButton.right
height: setTextAreaHeight()
////
//// (contentHeight > font.pixelSize)? contentHeight +font.pixelSize : parent.styles.height
width: chatView.width - width: chatView.width -
(sendButton.width + sendButton.anchors.margins) - (sendButton.width + sendButton.anchors.margins) -
(attachButton.width + attachButton.anchors.margins) - (attachButton.width + attachButton.anchors.margins) -
(emojiButton.width + emojiButton.anchors.margins) (emojiButton.width + emojiButton.anchors.margins)
TextArea
{
property var styles: StyleChat.inferiorPanel.msgComposer
id: msgField
height:
(contentHeight > font.pixelSize)?
contentHeight +font.pixelSize : parent.styles.height
width: parent.width
Layout.maximumHeight: chatView.height / styles.maxHeight
placeholderText: styles.placeHolder placeholderText: styles.placeHolder
background: styles.background background: styles.background
@ -151,23 +156,12 @@ Item
} }
} }
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
}
} }
} }
BtnIcon { BtnIcon {
id: emojiButton id: emojiButton