Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Quick tips to adjust font size: Difference between revisions
Jump to navigation
Jump to search
AutoSpider (talk | contribs) (Decode HTML entity names) |
Henri Vikki (talk | contribs) (Links & formatting) |
||
Line 1: | Line 1: | ||
[[Category:Snippets]] | |||
[[Category:HowTo]] | |||
[[Category:Learning::Demos and Examples]] | |||
= 4 Quick tips to adjust Font Size. = | = 4 Quick tips to adjust Font Size. = | ||
Use [ | Use [http://doc.qt.io/qt-5/qfont.html QFont Class] | ||
==== When you know font size in terms of Integer , | ==== When you know font size in terms of Integer , ==== | ||
<code>void QFont::setPointSize ( int pointSize )<code> | <code>void QFont::setPointSize ( int pointSize )</code> | ||
==== Sometimes , it is required that we need font size other than the prescribed sizes. ==== | ==== Sometimes , it is required that we need font size other than the prescribed sizes. ==== | ||
< | <code>void QFont::setPointSizeF ( qreal pointSize )</code> | ||
is really useful in that manner. | |||
==== Stylesheet ==== | ==== Stylesheet ==== | ||
Line 19: | Line 23: | ||
</code> | </code> | ||
''' | |||
=== We can use HTML tags as well, when applicable. === | === We can use HTML tags as well, when applicable. === | ||
''' | ''' | ||
Revision as of 10:00, 8 April 2015
4 Quick tips to adjust Font Size.
Use QFont Class
When you know font size in terms of Integer ,
void QFont::setPointSize ( int pointSize )
Sometimes , it is required that we need font size other than the prescribed sizes.
void QFont::setPointSizeF ( qreal pointSize )
is really useful in that manner.
Stylesheet
Using style sheet must be the simplest way.
void setStyleSheet ( const QString & sheet )
label->setStyleSheet ("Font : 12pt");
We can use HTML tags as well, when applicable.