Commit 7a59aa64 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(Chat/IncomingMessage): fix binding loop on `width`/`height`

parent 7c7b59a6
...@@ -16,7 +16,7 @@ ColumnLayout { ...@@ -16,7 +16,7 @@ ColumnLayout {
model: ListModel { model: ListModel {
ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: 'This is it: fefe efzzzzzzzzzz aaaaaaaaa erfeezffeefzfzefzefzezfefez wfef efef e efeffefe fee efefefeefef fefefefefe eff fefefe fefeffww.linphone.org' } ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: 'This is it: fefe efzzzzzzzzzz aaaaaaaaa erfeezffeefzfzefzefzezfefez wfef efef e efeffefe fee efefefeefef fefefefefe eff fefefe fefeffww.linphone.org' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389133000; $type: 'event'; $content: 'incoming_call' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389133000; $type: 'event'; $content: 'incoming_call' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389439000; $type: 'message'; $content: 'Perfect!' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389439000; $type: 'message'; $content: 'Perfect! bg g vg gv v g v hgv gv gv jhb jh b jb jh hg vg cfcy f v u uyg f tf tf ft f tf t t fy ft f tu ty f rd rd d d uu gu y gg y f r dr ' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389500000; $type: 'event'; $content: 'hangup' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389500000; $type: 'event'; $content: 'hangup' }
ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465924321000; $type: 'message'; $content: 'You\'ve heard the expression, "Just believe it and it will come." Well, technically, that is true, however, \'believing\' is not just thinking that you can have it...' } ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465924321000; $type: 'message'; $content: 'You\'ve heard the expression, "Just believe it and it will come." Well, technically, that is true, however, \'believing\' is not just thinking that you can have it...' }
ListElement { $dateSection: 1465994221000; $timestamp: 1465924391000; $type: 'event'; $content: 'lost_incoming_call' } ListElement { $dateSection: 1465994221000; $timestamp: 1465924391000; $type: 'event'; $content: 'lost_incoming_call' }
...@@ -58,15 +58,15 @@ ColumnLayout { ...@@ -58,15 +58,15 @@ ColumnLayout {
section.property: '$dateSection' section.property: '$dateSection'
delegate: Rectangle { delegate: Rectangle {
anchors.left: parent.left anchors.left: parent ? parent.left : undefined
anchors.leftMargin: 18 anchors.leftMargin: 18
anchors.right: parent.right anchors.right: parent ? parent.right : undefined
anchors.rightMargin: 18 anchors.rightMargin: 18
// Unable to use `height` property. // Unable to use `height` property.
// The height is given by message height. // The height is given by message height.
implicitHeight: layout.height + 10 implicitHeight: layout.height + 10
width: parent.width width: parent ? parent.width : 0
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
...@@ -77,6 +77,7 @@ ColumnLayout { ...@@ -77,6 +77,7 @@ ColumnLayout {
RowLayout { RowLayout {
id: layout id: layout
spacing: 0 spacing: 0
// The height is computed with the message height. // The height is computed with the message height.
...@@ -122,8 +123,10 @@ ColumnLayout { ...@@ -122,8 +123,10 @@ ColumnLayout {
// Display content. // Display content.
Loader { Loader {
Layout.fillWidth: true
id: loader id: loader
Layout.fillWidth: true
source: $type === 'message' source: $type === 'message'
? ( ? (
'qrc:/ui/modules/Linphone/Chat/' + 'qrc:/ui/modules/Linphone/Chat/' +
......
...@@ -5,23 +5,20 @@ import Linphone 1.0 ...@@ -5,23 +5,20 @@ import Linphone 1.0
// =================================================================== // ===================================================================
Item { RowLayout {
implicitHeight: message.height implicitHeight: message.height
spacing: 10
RowLayout { Avatar {
anchors.fill: parent Layout.alignment: Qt.AlignTop
spacing: 10 Layout.preferredHeight: 30
Layout.preferredWidth: 30
}
Avatar { Message {
Layout.alignment: Qt.AlignTop id: message
Layout.preferredHeight: 30
Layout.preferredWidth: 30
}
Message { Layout.fillWidth: true
Layout.fillWidth: true backgroundColor: '#BFBFBF'
backgroundColor: '#BFBFBF'
id: message
}
} }
} }
...@@ -3,15 +3,16 @@ import QtQuick 2.7 ...@@ -3,15 +3,16 @@ import QtQuick 2.7
// =================================================================== // ===================================================================
Item { Item {
id: container
default property alias content: content.data default property alias content: content.data
property alias backgroundColor: rectangle.color property alias backgroundColor: rectangle.color
id: container
implicitHeight: text.contentHeight + text.padding * 2 implicitHeight: text.contentHeight + text.padding * 2
width: parent.width - text.padding * 2
Rectangle { Rectangle {
id: rectangle id: rectangle
height: parent.height height: parent.height
radius: 4 radius: 4
width: ( width: (
...@@ -22,9 +23,10 @@ Item { ...@@ -22,9 +23,10 @@ Item {
} }
Text { Text {
id: text
anchors.left: container.left anchors.left: container.left
anchors.right: container.right anchors.right: container.right
id: text
padding: 8 padding: 8
text: $content text: $content
wrapMode: Text.Wrap wrapMode: Text.Wrap
...@@ -34,7 +36,8 @@ Item { ...@@ -34,7 +36,8 @@ Item {
} }
Item { Item {
anchors.left: rectangle.right
id: content id: content
anchors.left: rectangle.right
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment