I am using this code to set a label on the pushbutton with size of 16
ui->pushButton->setText(tr("<font size=16>Tank 1 \n %1%2C</font>").arg(szTemp).arg(degree));
but I am getting the output as <font size=16>Tank 1 005c</font> written on pushbutton.
How to set the font size?
The text value of a
QPushButtonis not “rich text” so it will not interpret your html as expected. Either use thesetFonton your widget to set the font size, or set it via a style sheet:Style sheets, while more powerful, can tend to be a bit more complex because it forces you to define a number of other features that you are now over-writting.