Qt 6.x
The Qt SDK
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() {
10QFont font("times", 24);
12int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
13int pixelsHigh = fm.height();
15
16Q_UNUSED(pixelsWide);
17Q_UNUSED(pixelsHigh);
18} // wrapper0
19
20
21void wrapper1() {
23QFont font("times", 24);
25qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
26qreal pixelsHigh = fm.height();
28
29Q_UNUSED(pixelsWide);
30Q_UNUSED(pixelsHigh);
31} // wrapper1
32
33} //src_gui_text_qfontmetrics
\reentrant \inmodule QtGui
qreal height() const
Returns the height of the font.
qreal horizontalAdvance(const QString &string, int length=-1) const
Returns the horizontal advance in pixels of the first length characters of text.
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
\reentrant
Definition qfont.h:20
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:92