Hi all, I want to use the scale property of a Text so that the enclosed text shows up in its entirety (no wrap) within the size of the Text itself.
I’d like to be able to operate directly on the scale property instead of changing the font size.

Everything works, as long as the text is left-aligned. If I switch the text alignment to center, the text box appears in the right place, but the text is not center-aligned.
I tried to change the transformOrigin to “Item.Center”, but this does not solve the problem.

Attached you can find an example featuring a text and a rectangle enclosing it:
Qt Code:
  1. Rectangle
  2. {
  3. id: rect
  4. anchors.fill: testText
  5. color: "yellow"
  6. }
  7.  
  8. Text
  9. {
  10. id: testText
  11.  
  12. width: 100
  13. height: 50
  14.  
  15. anchors.centerIn: parent
  16.  
  17. text: "example"
  18. verticalAlignment: Text.AlignVCenter
  19. horizontalAlignment: Text.AlignHCenter
  20.  
  21. scale: Math.min((width / paintedWidth), (height / paintedHeight))
  22. transformOrigin: Item.Center // <- I've tried every point...
  23. color: "black"
  24. }
To copy to clipboard, switch view to plain text mode 

here you can see the (wrong) result: http://i59.tinypic.com/29c9ymg.jpg