1 | // Copyright (C) 2017 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 QQUICKLABEL_P_P_H |
5 | #define QQUICKLABEL_P_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 <QtQml/private/qlazilyallocated_p.h> |
19 | #include <QtQuick/private/qquicktext_p_p.h> |
20 | #include <QtQuick/private/qquickitemchangelistener_p.h> |
21 | #include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h> |
22 | #include <QtQuickTemplates2/private/qquicktheme_p.h> |
23 | |
24 | #if QT_CONFIG(accessibility) |
25 | #include <QtGui/qaccessible.h> |
26 | #endif |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class Q_AUTOTEST_EXPORT QQuickLabelPrivate : public QQuickTextPrivate, public QQuickItemChangeListener |
31 | #if QT_CONFIG(accessibility) |
32 | , public QAccessible::ActivationObserver |
33 | #endif |
34 | { |
35 | public: |
36 | Q_DECLARE_PUBLIC(QQuickLabel) |
37 | |
38 | QQuickLabelPrivate(); |
39 | ~QQuickLabelPrivate(); |
40 | |
41 | static QQuickLabelPrivate *get(QQuickLabel *item) |
42 | { |
43 | return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(o: item)); |
44 | } |
45 | |
46 | inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); } |
47 | inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; } |
48 | inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; } |
49 | inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; } |
50 | inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; } |
51 | |
52 | void setTopInset(qreal value, bool reset = false); |
53 | void setLeftInset(qreal value, bool reset = false); |
54 | void setRightInset(qreal value, bool reset = false); |
55 | void setBottomInset(qreal value, bool reset = false); |
56 | |
57 | void resizeBackground(); |
58 | |
59 | void resolveFont(); |
60 | void inheritFont(const QFont &font); |
61 | void updateFont(const QFont &font); |
62 | inline void setFont_helper(const QFont &font) { |
63 | if (sourceFont.resolveMask() == font.resolveMask() && sourceFont == font) |
64 | return; |
65 | updateFont(font); |
66 | } |
67 | |
68 | void textChanged(const QString &text); |
69 | |
70 | #if QT_CONFIG(accessibility) |
71 | void accessibilityActiveChanged(bool active) override; |
72 | QAccessible::Role accessibleRole() const override; |
73 | void maybeSetAccessibleName(const QString &name); |
74 | #endif |
75 | |
76 | void cancelBackground(); |
77 | void executeBackground(bool complete = false); |
78 | |
79 | void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; |
80 | void itemImplicitWidthChanged(QQuickItem *item) override; |
81 | void itemImplicitHeightChanged(QQuickItem *item) override; |
82 | void itemDestroyed(QQuickItem *item) override; |
83 | |
84 | QPalette defaultPalette() const override; |
85 | |
86 | struct { |
87 | bool = false; |
88 | bool = false; |
89 | bool = false; |
90 | bool = false; |
91 | bool = false; |
92 | bool = false; |
93 | qreal = 0; |
94 | qreal = 0; |
95 | qreal = 0; |
96 | qreal = 0; |
97 | QFont ; |
98 | }; |
99 | QLazilyAllocated<ExtraData> ; |
100 | |
101 | bool resizingBackground = false; |
102 | QPalette resolvedPalette; |
103 | QQuickDeferredPointer<QQuickItem> background; |
104 | }; |
105 | |
106 | QT_END_NAMESPACE |
107 | |
108 | #endif // QQUICKLABEL_P_P_H |
109 | |