QLabel, set text size help
-
wrote on 13 Sept 2012, 15:18 last edited by
Hi, I want to set text size in my QLabel. But here is the problem. When i use setPointSize, size 9 is too small and size 10 is too big. Same problem with setPixelSize. Do you have any other idea, how set point size to 9,5 or similar?
-
wrote on 13 Sept 2012, 18:56 last edited by
Use a font that supports such fractional sizes and/or has the size you want. Fonts usually can't be resized to all thinkable sizes as they would look very blurred.
-
wrote on 14 Sept 2012, 05:01 last edited by
You can use the style sheet as well, conveniently from the designer , or programmatically.
For example,
@label->setStyleSheet("font: 18pt;");@EDIT :
Did not try with 9.5. Can't notice ,if there is any difference. -
wrote on 14 Sept 2012, 12:12 last edited by
DerManu: Thanks for tip, do you know any font, that can fit ? I havent found it yet.
Rahul Das: I tried this too, but there is no difference between 9,5 and 10.
Any other idea? Exist some function, that can take the label like picture or something, and resize it like 90% or 110% from original size?
-
wrote on 14 Sept 2012, 14:24 last edited by
Hi Andell,
try to use HTML tags. Examples :
@
QLabel("<span style="font-size:9.5em; ">kdkdk hhyy</span>");
@
or
@
QLabel("<span style="font-size:9.5ex; ">gdgdg</span>");
@
or
@
QLabel("<span style="font-size:5%; ">ldldl</span>");
@
or
@
QLabel("<span style="font-size:small; ">ldldl</span>");
// and use : xx-small , x-small, small, medium, large, x-large, xx-large
@ -
wrote on 17 Sept 2012, 04:52 last edited by
Yes, you can use [[doc:QFont]]
@
QFont::pointSizeF ()@function as well.
bq. Rahul Das: I tried this too, but there is no difference between 9,5 and 10.
Try with bigger font size,like 29.5 and 30. You can make out the difference.
6/6