1// Copyright (C) 2024 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 QQUICKFONTINFO_P_H
5#define QQUICKFONTINFO_P_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#include <QtGui/qfontinfo.h>
22#include <QtCore/qobject.h>
23
24#include <QtQuick/private/qquickvaluetypes_p.h>
25
26QT_BEGIN_NAMESPACE
27
28class Q_QUICK_EXPORT QQuickFontInfo : public QObject
29{
30 Q_OBJECT
31
32 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
33 Q_PROPERTY(QString family READ family NOTIFY fontChanged FINAL)
34 Q_PROPERTY(QString styleName READ styleName NOTIFY fontChanged FINAL)
35 Q_PROPERTY(int pixelSize READ pixelSize NOTIFY fontChanged FINAL)
36 Q_PROPERTY(qreal pointSize READ pointSize NOTIFY fontChanged FINAL)
37 Q_PROPERTY(bool italic READ italic NOTIFY fontChanged FINAL)
38 Q_PROPERTY(int weight READ weight NOTIFY fontChanged FINAL)
39 Q_PROPERTY(bool bold READ bold NOTIFY fontChanged FINAL)
40 Q_PROPERTY(bool fixedPitch READ fixedPitch NOTIFY fontChanged FINAL)
41 Q_PROPERTY(QQuickFontEnums::Style style READ style NOTIFY fontChanged FINAL)
42 Q_PROPERTY(QList<QFontVariableAxis> variableAxes READ variableAxes NOTIFY fontChanged FINAL)
43 QML_NAMED_ELEMENT(FontInfo)
44 QML_ADDED_IN_VERSION(6, 9)
45public:
46 explicit QQuickFontInfo(QObject *parent = nullptr);
47 ~QQuickFontInfo() override;
48
49 QFont font() const;
50 void setFont(QFont font);
51
52 QString family() const;
53 QString styleName() const;
54 int pixelSize() const;
55 qreal pointSize() const;
56 bool italic() const;
57 int weight() const;
58 bool bold() const;
59 bool underline() const;
60 bool overline() const;
61 bool strikeOut() const;
62 bool fixedPitch() const;
63 QQuickFontEnums::Style style() const;
64 QList<QFontVariableAxis> variableAxes() const;
65
66Q_SIGNALS:
67 void fontChanged();
68
69private:
70 QFont m_font;
71 QFontInfo m_info;
72};
73
74QT_END_NAMESPACE
75
76#endif // QQUICKFONTINFO_P_H
77

source code of qtdeclarative/src/quick/util/qquickfontinfo_p.h