[Interest] QML Text.contentWidth is never increasing

Kristoffersen, Even (NO14) Even.Kristoffersen at Honeywell.com
Fri Oct 21 10:02:44 CEST 2016


Jason H wrote:
>Text {
>	id: instructionText
>	color: "white"
>	text: instructionTextData
>	width: contentWidth > parent.width *.9 ? parent.width *.9 : contentWidth
>	font.pointSize: 16
>	horizontalAlignment: Text.AlignHCenter
>	anchors.horizontalCenter: parent.horizontalCenter }
>
>Where I want the text to be it's natural width up to 90% of the parent width, then wrap, but it only works when initially laying out and shrinking. 

I think I'm missing some use case, why bother setting the width to contentWidth?
You anyway center the Text element and the text inside it so nothing prevents you from always setting it to parent.width *.9?
The text will then still be centered inside the Text element, and the Text element centered in its parent.

-Even



More information about the Interest mailing list