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
qquicklabel_p_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKLABEL_P_P_H
6#define QQUICKLABEL_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQml/private/qlazilyallocated_p.h>
20#include <QtQuick/private/qquicktext_p_p.h>
21#include <QtQuick/private/qquickitemchangelistener_p.h>
22#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
23#include <QtQuickTemplates2/private/qquicktheme_p.h>
24
25#if QT_CONFIG(accessibility)
26#include <QtGui/qaccessible.h>
27#endif
28
30
31class Q_AUTOTEST_EXPORT QQuickLabelPrivate : public QQuickTextPrivate,
32 public QSafeQuickItemChangeListener<QQuickLabelPrivate>
33#if QT_CONFIG(accessibility)
34 , public QAccessible::ActivationObserver
35#endif
36{
37public:
38 Q_DECLARE_PUBLIC(QQuickLabel)
39
40 QQuickLabelPrivate();
41 ~QQuickLabelPrivate();
42
43 static QQuickLabelPrivate *get(QQuickLabel *item)
44 {
45 return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(item));
46 }
47
48 inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
49 inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
50 inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
51 inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
52 inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
53
54 void setTopInset(qreal value, bool reset = false);
55 void setLeftInset(qreal value, bool reset = false);
56 void setRightInset(qreal value, bool reset = false);
57 void setBottomInset(qreal value, bool reset = false);
58
59 void resizeBackground();
60
61 void resolveFont();
62 void inheritFont(const QFont &font);
63 void updateFont(const QFont &font);
64 inline void setFont_helper(const QFont &font) {
65 if (sourceFont.resolveMask() == font.resolveMask() && sourceFont == font)
66 return;
67 updateFont(font);
68 }
69
70 void textChanged(const QString &text);
71
72#if QT_CONFIG(accessibility)
73 void accessibilityActiveChanged(bool active) override;
74 QAccessible::Role accessibleRole() const override;
75 void maybeSetAccessibleName(const QString &name);
76#endif
77
78 void cancelBackground();
79 void executeBackground(bool complete = false);
80
81 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
82 void itemImplicitWidthChanged(QQuickItem *item) override;
83 void itemImplicitHeightChanged(QQuickItem *item) override;
84 void itemDestroyed(QQuickItem *item) override;
85
86 QPalette defaultPalette() const override;
87
88 struct ExtraData {
89 bool hasTopInset = false;
90 bool hasLeftInset = false;
91 bool hasRightInset = false;
92 bool hasBottomInset = false;
93 bool hasBackgroundWidth = false;
94 bool hasBackgroundHeight = false;
95 qreal topInset = 0;
96 qreal leftInset = 0;
97 qreal rightInset = 0;
98 qreal bottomInset = 0;
99 QFont requestedFont;
100 };
101 QLazilyAllocated<ExtraData> extra;
102
103 bool resizingBackground = false;
104 QPalette resolvedPalette;
105 QQuickDeferredPointer<QQuickItem> background;
106};
107
108QT_END_NAMESPACE
109
110#endif // QQUICKLABEL_P_P_H
static bool isKeyFocusReason(Qt::FocusReason reason)
static QString contentItemName()