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 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)
placeholderText: styles.placeHolder TextArea
background: styles.background {
property var styles: StyleChat.inferiorPanel.msgComposer
id: msgField
wrapMode: TextEdit.Wrap height:
(contentHeight > font.pixelSize)?
contentHeight +font.pixelSize : parent.styles.height
onTextChanged: { width: parent.width
if (msgComposer.length == 0)
{
sendButton.state = ""
}
else if (msgComposer.length > 0)
{
sendButton.state = "SENDBTN"
}
}
function setTextAreaHeight (){ Layout.maximumHeight: chatView.height / styles.maxHeight
if (msgComposer.height >= chatView.height / msgComposer.styles.maxHeight)
{ placeholderText: styles.placeHolder
return msgComposer.height background: styles.background
}
else if (contentHeight > font.pixelSize) wrapMode: TextEdit.Wrap
{
return msgComposer.contentHeight + msgComposer.font.pixelSize onTextChanged: {
} if (msgComposer.length == 0)
else {
{ sendButton.state = ""
return parent.styles.height }
else if (msgComposer.length > 0)
{
sendButton.state = "SENDBTN"
}
} }
} }
} }
BtnIcon { BtnIcon {
id: emojiButton id: emojiButton