Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_gui_text_qfontmetrics.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
<
QFontMetrics
>
5
6
namespace
src_gui_text_qfontmetrics
{
7
8
void
wrapper0
() {
9
//! [0]
10
QFont font(
"times"
, 24);
11
QFontMetrics fm(font);
12
int
pixelsWide = fm.horizontalAdvance(
"What's the advance width of this text?"
);
13
int
pixelsHigh = fm.height();
14
//! [0]
15
16
Q_UNUSED(pixelsWide);
17
Q_UNUSED(pixelsHigh);
18
}
// wrapper0
19
20
21
void
wrapper1
() {
22
//! [1]
23
QFont font(
"times"
, 24);
24
QFontMetricsF fm(font);
25
qreal pixelsWide = fm.horizontalAdvance(
"What's the advance width of this text?"
);
26
qreal pixelsHigh = fm.height();
27
//! [1]
28
29
Q_UNUSED(pixelsWide);
30
Q_UNUSED(pixelsHigh);
31
}
// wrapper1
32
33
}
//src_gui_text_qfontmetrics
src_gui_text_qfontmetrics
Definition
src_gui_text_qfontmetrics.cpp:6
src_gui_text_qfontmetrics::wrapper0
void wrapper0()
Definition
src_gui_text_qfontmetrics.cpp:8
src_gui_text_qfontmetrics::wrapper1
void wrapper1()
Definition
src_gui_text_qfontmetrics.cpp:21
qtbase
src
gui
doc
snippets
code
src_gui_text_qfontmetrics.cpp
Generated on
for Qt by
1.14.0