I am trying to stretch text in label to it's size.
For example, if I increase the height of the label, then the inner text's size should be increased only vertically.
If I increase the width of the label, then the inner text's size should be increased and stretched only horizontally.
How can I do this?
You could use a
QPainterPathand aQTransformto deform your text:Draw your text in a
QPainterPathwith a arbritrary font size. Based on the sizes of your widget and your path, you will get the scale factor. Transform your path, then draw it: