I would like to put text inside a bubble, and I want that my bubble be equal to the text width, but if the text length is too long, I would like the text to wrap automatically a
Very late to the party but the clean solution is to use an embedded TextMetrics object. Like this:
...
Text {
id: textObj
width: Math.min(textWidth, myThreshold)
// access to binding-loop-free width and height:
readonly property alias textWidth: textMetrics.boundingRect.width
readonly property alias textHeight: textMetrics.boundingRect.height
TextMetrics {
id: textMetrics
font: textObj.font
text: textObj.text
elide: textObj.elide
}
}