Quick tips to adjust font size

From Qt Wiki
Revision as of 12:07, 24 May 2015 by Wieland (talk | contribs) (Removed from Category:Howto and Category:Learning::Demos_and_Examples (is only a snippet))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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.