View Full Version : how to set fontsize for label?
BalaQT
18th September 2009, 14:22
hi,
im using
lbl->setFont(QFont("Trebuchet",12,QFont::Bold));
where lbl is QLabel
for font size and font bold.
How to set FontSize directly ? (without mentioning fontname as above)
like lbl.setFontSize
Thnks
Bala
babu198649
18th September 2009, 15:15
QFont font = lbl->font ();
font.setPointSize(12);//set the font size here
lbl->setFont(font);
Piskvorkar
18th September 2009, 16:31
Hi,
I don't see any problem in first way with creating font inside method setPointSize() as post BalaQt.
Maybe problem could be if font "Trebuchet" doesn't exist (then Qt maybe use another font and don't respect set size).
But if you realy only want to change font size and keep font family, the second way is ok.
[edit]: sorry .. i don't read first message properly
BalaQT
18th September 2009, 17:02
thks babu
Bala
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.