Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickfontmetrics_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKFONTMETRICS_H
5#define QQUICKFONTMETRICS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qtquickglobal_p.h>
19
20#include <QtQml/qqml.h>
21
22#include <QtGui/qfontmetrics.h>
23
24#include <QtCore/qobject.h>
25
27
28class QFont;
29
30class Q_QUICK_EXPORT QQuickFontMetrics : public QObject
31{
33
34 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
35 Q_PROPERTY(qreal ascent READ ascent NOTIFY fontChanged)
36 Q_PROPERTY(qreal descent READ descent NOTIFY fontChanged)
37 Q_PROPERTY(qreal height READ height NOTIFY fontChanged)
38 Q_PROPERTY(qreal leading READ leading NOTIFY fontChanged)
39 Q_PROPERTY(qreal lineSpacing READ lineSpacing NOTIFY fontChanged)
40 Q_PROPERTY(qreal minimumLeftBearing READ minimumLeftBearing NOTIFY fontChanged)
41 Q_PROPERTY(qreal minimumRightBearing READ minimumRightBearing NOTIFY fontChanged)
42 Q_PROPERTY(qreal maximumCharacterWidth READ maximumCharacterWidth NOTIFY fontChanged)
43 Q_PROPERTY(qreal xHeight READ xHeight NOTIFY fontChanged)
44 Q_PROPERTY(qreal averageCharacterWidth READ averageCharacterWidth NOTIFY fontChanged)
45 Q_PROPERTY(qreal underlinePosition READ underlinePosition NOTIFY fontChanged)
46 Q_PROPERTY(qreal overlinePosition READ overlinePosition NOTIFY fontChanged)
47 Q_PROPERTY(qreal strikeOutPosition READ strikeOutPosition NOTIFY fontChanged)
48 Q_PROPERTY(qreal lineWidth READ lineWidth NOTIFY fontChanged)
49 QML_NAMED_ELEMENT(FontMetrics)
51public:
52 explicit QQuickFontMetrics(QObject *parent = nullptr);
53
54 QFont font() const;
55 void setFont(const QFont &font);
56
57 qreal ascent() const;
58 qreal descent() const;
59 qreal height() const;
60 qreal leading() const;
61 qreal lineSpacing() const;
62 qreal minimumLeftBearing() const;
63 qreal minimumRightBearing() const;
64 qreal maximumCharacterWidth() const;
65
66 qreal xHeight() const;
67 qreal averageCharacterWidth() const;
68
69 qreal underlinePosition() const;
70 qreal overlinePosition() const;
71 qreal strikeOutPosition() const;
72 qreal lineWidth() const;
73
74 Q_INVOKABLE qreal advanceWidth(const QString &text) const;
76 Q_INVOKABLE QRectF tightBoundingRect(const QString &text) const;
77 Q_INVOKABLE QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const;
78
80 void fontChanged(const QFont &font);
81
83 QFont m_font;
84 QFontMetricsF m_metrics;
85};
86
88
89#endif // QQUICKFONTMETRICS_H
\reentrant \inmodule QtGui
\reentrant
Definition qfont.h:22
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString text
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLenum mode
GLint GLsizei GLsizei height
GLint GLsizei width
GLbitfield flags
static const QRectF boundingRect(const QPointF *points, int pointCount)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit