Changing the line height of QLabel
-
Hi. I have the following QLabel, with the following text:
Sample temperature
This is what it looks like on my application:
I am wondering how to make the line height of QLabel smaller. I haven't found any documentation for this, somehow, despite the feature being relatively basic. Please let me know if I missed anything or if more info is required.
-
@Dummie1138 The natural vertical spacing of text automatically wrapped or with deliberate line breaks is given by QFontMetrics::lineSpacing(). This figure is a function of font and size and is not adjustable out-of-the box.
You can subclass QLabel and provide your own rendering.
-
@Dummie1138 What lines do you mean?
Or do you mean alignment and stretching? -
@Dummie1138
Is your QLabel in a layout ? -
@Dummie1138 said in Changing the line height of QLabel:
my QLabel is built in the .ui files.
This does not mean that you're using layouts. So the question from @mpergand is still not answered.
-
@Dummie1138 The natural vertical spacing of text automatically wrapped or with deliberate line breaks is given by QFontMetrics::lineSpacing(). This figure is a function of font and size and is not adjustable out-of-the box.
You can subclass QLabel and provide your own rendering.
-