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
7
8void wrapper0() {
9//! [0]
10QFont font("times", 24);
11QFontMetrics fm(font);
12int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
13int pixelsHigh = fm.height();
14//! [0]
15
16Q_UNUSED(pixelsWide);
17Q_UNUSED(pixelsHigh);
18} // wrapper0
19
20
21void wrapper1() {
22//! [1]
23QFont font("times", 24);
24QFontMetricsF fm(font);
25qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
26qreal pixelsHigh = fm.height();
27//! [1]
28
29Q_UNUSED(pixelsWide);
30Q_UNUSED(pixelsHigh);
31} // wrapper1
32
33} //src_gui_text_qfontmetrics