mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Add text wrap behaivour on bubbles
This commit is contained in:
parent
4a90436e8e
commit
92bcd4cbfd
@ -22,6 +22,7 @@ Item {
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: rootBubble
|
||||
anchors.fill: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@ -29,7 +30,10 @@ Item {
|
||||
Rectangle
|
||||
{
|
||||
id: bubble
|
||||
width: Math.max(mesageText.implicitWidth, sendersName.implicitWidth ) + timeText.implicitWidth + styles.aditionalBubbleWidth
|
||||
width: Math.min (
|
||||
rootBubble.width * styles.bubbleMaxWidth,
|
||||
Math.max(mesageText.implicitWidth, sendersName.implicitWidth )
|
||||
) + timeText.implicitWidth + styles.aditionalBubbleWidth
|
||||
height: mesageText.height + sendersName.height + styles.aditionalBubbleHeight
|
||||
|
||||
|
||||
@ -77,7 +81,7 @@ Item {
|
||||
Text {
|
||||
id: mesageText
|
||||
text: model.msg
|
||||
|
||||
width: rootBubble.width * styles.bubbleMaxWidth
|
||||
anchors.left: (model.incoming)? parent.left : undefined
|
||||
anchors.right:(!model.incoming)? parent.right : undefined
|
||||
|
||||
@ -85,11 +89,13 @@ Item {
|
||||
anchors.leftMargin: styles.lMarginBubble
|
||||
anchors.rightMargin: styles.rMarginBubble
|
||||
|
||||
// wrapMode: Text.Wrap
|
||||
horizontalAlignment: (!model.incoming &&
|
||||
mesageText.implicitWidth <= (rootBubble.width * styles.bubbleMaxWidth)
|
||||
)? Text.AlignRight : Text.AlignLeft
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,13 +3,14 @@ pragma Singleton
|
||||
|
||||
QtObject {
|
||||
|
||||
// Margins
|
||||
// Bubble measures
|
||||
readonly property int lMarginBubble: 10
|
||||
readonly property int rMarginBubble: 10
|
||||
readonly property int tMarginBubble: 5
|
||||
readonly property int bMarginBubble: 10
|
||||
readonly property int aditionalBubbleHeight: tMarginBubble * 2
|
||||
readonly property int aditionalBubbleWidth: 30
|
||||
readonly property real bubbleMaxWidth: 0.5 // % from parent
|
||||
|
||||
// BubbleProps
|
||||
readonly property int radius: 5
|
||||
|
Loading…
Reference in New Issue
Block a user