Give more space to time and message in the sended messages bubbles

This commit is contained in:
Angela Mazzurco 2017-06-09 15:58:39 +02:00
parent c9f39af4c4
commit 3746e22b27

View File

@ -51,7 +51,9 @@ Item {
anchors.left: (model.incoming)? parent.left : undefined anchors.left: (model.incoming)? parent.left : undefined
anchors.right:(!model.incoming)? parent.right : undefined anchors.right:(!model.incoming)? parent.right : undefined
height: (model.incoming)? implicitHeight : 0 // Used for give minimum heigh to time when the message is bigger than the bubble in sended messages
height: (model.incoming || !model.incoming &&
mesageText.implicitWidth >= (rootBubble.width * styles.bubbleMaxWidth) )? implicitHeight : 0
} }
Text { Text {
@ -66,13 +68,14 @@ Item {
anchors.leftMargin: styles.lMarginBubble anchors.leftMargin: styles.lMarginBubble
anchors.rightMargin: styles.rMarginBubble anchors.rightMargin: styles.rMarginBubble
anchors.topMargin: styles.tMarginBubble anchors.topMargin: styles.tMarginBubble
} }
Text { Text {
id: mesageText id: mesageText
text: model.msg text: model.msg
width: rootBubble.width * styles.bubbleMaxWidth width: rootBubble.width * styles.bubbleMaxWidth + timeText.width
anchors.left: (model.incoming)? parent.left : undefined anchors.left: (model.incoming)? parent.left : undefined
anchors.right:(!model.incoming)? parent.right : undefined anchors.right:(!model.incoming)? parent.right : undefined
@ -80,9 +83,10 @@ Item {
anchors.leftMargin: styles.lMarginBubble anchors.leftMargin: styles.lMarginBubble
anchors.rightMargin: styles.rMarginBubble anchors.rightMargin: styles.rMarginBubble
horizontalAlignment: (!model.incoming && // Used for the correct alineation when the message must be on right
mesageText.implicitWidth <= (rootBubble.width * styles.bubbleMaxWidth) horizontalAlignment:(!model.incoming &&
)? Text.AlignRight : Text.AlignLeft mesageText.implicitWidth <= (rootBubble.width * styles.bubbleMaxWidth)
)? Text.AlignRight : Text.AlignLeft
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }