Quick tips to adjust font size: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 3: Line 3:
Use [[doc:QFont]] class
Use [[doc:QFont]] class


==== When you know font size in terms of Integer ,<br /><code>void QFont::setPointSize ( int pointSize )<code> ====
==== When you know font size in terms of Integer ,
<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. ====
Line 11: Line 12:
==== Stylesheet ====
==== Stylesheet ====


Using style sheet must be the simplest way.<br /><code><br />void setStyleSheet ( const QString &amp; sheet )<br />label-&gt;setStyleSheet (&quot;Font : 12pt&amp;quot;);<br /></code>
Using style sheet must be the simplest way.
<code>
void setStyleSheet ( const QString &amp; sheet )
label->setStyleSheet ("Font : 12pt");
</code>


''''
''''
Line 19: Line 24:
''''
''''


'''Categories'''<br />[[snippets]]<br />[[HowTo]]<br />[[Learning::Demos_and_Examples]]
'''Categories'''
[[snippets]]
[[HowTo]]
[[Learning::Demos_and_Examples]]

Revision as of 13:24, 25 February 2015

h1. 4 Quick tips to adjust Font Size.

Use doc:QFont class

==== When you know font size in terms of Integer ,

void QFont::setPointSize ( int pointSize )<code> ====

==== 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 &amp; sheet )
label->setStyleSheet ("Font : 12pt");

'

We can use HTML tags as well, when applicable.

'

Categories snippets HowTo Learning::Demos_and_Examples