Hi All,
How to change font size for a QLabel? Qlabel was created fron QDesigner.
Before querying to you all I tried changing code as explained in previous posts.
http://www.qtcentre.org/forum/f-qt-p...size-5508.html
http://www.qtcentre.org/forum/f-qt-p...view-8597.html
snippet of code:
Method 1:
label1->setText("Qt Label1");
//set font
QFont font
= label1
->font
();
font.setPointSize(72);
font.setBold(true);
label1->setFont(font);
label1->setText("Qt Label1");
//set font
QFont font = label1->font();
font.setPointSize(72);
font.setBold(true);
label1->setFont(font);
To copy to clipboard, switch view to plain text mode
Method 2:
QString ritchText
("<html><head><meta name=\"qrichtext\" content=\"1\" /></head>" "<body style=\" white-space: pre-wrap; font-family:Sans Serif; "
"font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; "
"margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:70pt;\">
Qt Label1 </p>" "</body></html>");
label1->setText(ritchText);
QString ritchText("<html><head><meta name=\"qrichtext\" content=\"1\" /></head>"
"<body style=\" white-space: pre-wrap; font-family:Sans Serif; "
"font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; "
"margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:70pt;\">
Qt Label1 </p>" "</body></html>");
label1->setText(ritchText);
To copy to clipboard, switch view to plain text mode
Even after the changes applied from above posts, it not increasing the font size for a QLabel.
The only difference I can see is my QLabel was created from QDesigner and in the posts it was created manually. Is this(creating qlabel from designer) causing me difficulty in changing the font size for a qlabel? Please help.
Thanks & Regards,
Arun.
Bookmarks