summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_text_qfont.cpp
blob: c74772cc0392ac729f9259074ca279d93d05725c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! [0]
QFont serifFont("Times", 10, QFont::Bold);
QFont sansFont("Helvetica [Cronyx]", 12);
//! [0]


//! [1]
QFont f("Helvetica");
//! [1]


//! [2]
QFont f("Helvetica [Cronyx]");
//! [2]


//! [3]
QFontInfo info(f1);
QString family = info.family();
//! [3]


//! [4]
QFontMetrics fm(f1);
int textWidthInPixels = fm.width("How many pixels wide is this text?");
int textHeightInPixels = fm.height();
//! [4]