Quick tips to adjust font size: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Removed from Category:Howto and Category:Learning::Demos_and_Examples (is only a snippet))
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
[[Category:Snippets]]


h1. 4 Quick tips to adjust Font Size.
= 4 Quick tips to adjust Font Size. =
Use [http://doc.qt.io/qt-5/qfont.html QFont Class]


Use [[doc:QFont]] class
==== When you know font size in terms of Integer , ====
 
<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. ====


</code>void QFont::setPointSizeF ( qreal pointSize )</code> is really useful in that manner.
<code>void QFont::setPointSizeF ( qreal pointSize )</code>
is really useful in that manner.


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


''''
'''


=== We can use HTML tags as well, when applicable. ===
=== We can use HTML tags as well, when applicable. ===


''''
'''
 
'''Categories'''
[[snippets]]
[[HowTo]]
[[Learning::Demos_and_Examples]]

Latest revision as of 12:07, 24 May 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.