
Originally Posted by
antialias_forum
However, I was hoping to get rid of the 'invisible text'-hack somehow.
You could scale the Text based on how much it exceeds your width at the specified pixelSize:
import Qt 4.7
Rectangle {
width: 200
height: 200
Text {
width: 200
height: 100
text: "Some sample text here"
font.pixelSize: height / 4
scale: paintedWidth > width ? (width / paintedWidth) : 1
transformOrigin: Item.TopLeft
}
}
import Qt 4.7
Rectangle {
width: 200
height: 200
Text {
width: 200
height: 100
text: "Some sample text here"
font.pixelSize: height / 4
scale: paintedWidth > width ? (width / paintedWidth) : 1
transformOrigin: Item.TopLeft
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks