Qt
6.x
The Qt SDK
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Symbols
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
Loading...
Searching...
No Matches
src_gui_text_qfont.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
#include <QFont>
4
#include <QFontInfo>
5
#include <QFontMetrics>
6
7
namespace
src_gui_text_qfont
{
8
9
void
wrapper0
() {
11
QFont
serifFont(
"Times"
, 10,
QFont::Bold
);
12
QFont
sansFont(
"Helvetica [Cronyx]"
, 12);
14
15
17
QFont
f
(
"Helvetica"
);
19
20
}
// wrapper0
21
22
23
void
wrapper1
() {
24
QFont
f1;
26
QFont
f
(
"Helvetica [Cronyx]"
);
28
29
31
QFontInfo
info
(f1);
32
QString
family =
info
.family();
34
35
37
QFontMetrics
fm(f1);
38
int
textWidthInPixels = fm.
horizontalAdvance
(
"How many pixels wide is this text?"
);
39
int
textHeightInPixels = fm.
height
();
41
42
Q_UNUSED
(textWidthInPixels);
43
Q_UNUSED
(textHeightInPixels);
44
}
// wrapper
45
}
// src_gui_text_qfont
QFontInfo
\reentrant
Definition
qfontinfo.h:14
QFontMetrics
\reentrant \inmodule QtGui
Definition
qfontmetrics.h:19
QFontMetrics::height
int height() const
Returns the height of the font.
Definition
qfontmetrics.cpp:291
QFontMetrics::horizontalAdvance
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
Definition
qfontmetrics.cpp:499
QFont
\reentrant
Definition
qfont.h:20
QFont::Bold
@ Bold
Definition
qfont.h:67
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:127
src_gui_text_qfont
Definition
src_gui_text_qfont.cpp:7
src_gui_text_qfont::wrapper1
void wrapper1()
Definition
src_gui_text_qfont.cpp:23
src_gui_text_qfont::wrapper0
void wrapper0()
Definition
src_gui_text_qfont.cpp:9
f
GLfloat GLfloat f
Definition
qopengles2ext.h:795
Q_UNUSED
#define Q_UNUSED(x)
Definition
qtpreprocessorsupport.h:20
info
QFileInfo info(fileName)
[8]
Definition
src_network_kernel_qhostinfo.cpp:44
qtbase
src
gui
doc
snippets
code
src_gui_text_qfont.cpp
Generated by
1.9.7