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.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_H
6#define QQUICKLABEL_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 <QtGui/qpalette.h>
20#include <QtQuick/private/qquicktext_p.h>
21#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
22
24
25class QQuickLabelPrivate;
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickLabel : public QQuickText
28{
29 Q_OBJECT
30 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
31 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
32 // 2.5 (Qt 5.12)
33 Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION(2, 5))
34 Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION(2, 5))
35 Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION(2, 5))
36 Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION(2, 5))
37 Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION(2, 5))
38 Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION(2, 5))
39 Q_CLASSINFO("DeferredPropertyNames", "background")
40 QML_NAMED_ELEMENT(Label)
41 QML_ADDED_IN_VERSION(2, 0)
42
43public:
44 explicit QQuickLabel(QQuickItem *parent = nullptr);
45 ~QQuickLabel();
46
47 QFont font() const;
48 void setFont(const QFont &font);
49
50 QQuickItem *background() const;
51 void setBackground(QQuickItem *background);
52
53 // 2.5 (Qt 5.12)
54 qreal implicitBackgroundWidth() const;
55 qreal implicitBackgroundHeight() const;
56
57 qreal topInset() const;
58 void setTopInset(qreal inset);
59 void resetTopInset();
60
61 qreal leftInset() const;
62 void setLeftInset(qreal inset);
63 void resetLeftInset();
64
65 qreal rightInset() const;
66 void setRightInset(qreal inset);
67 void resetRightInset();
68
69 qreal bottomInset() const;
70 void setBottomInset(qreal inset);
71 void resetBottomInset();
72
73Q_SIGNALS:
74 void fontChanged();
75 void backgroundChanged();
76 // 2.5 (Qt 5.12)
77 Q_REVISION(2, 5) void implicitBackgroundWidthChanged();
78 Q_REVISION(2, 5) void implicitBackgroundHeightChanged();
79 Q_REVISION(2, 5) void topInsetChanged();
80 Q_REVISION(2, 5) void leftInsetChanged();
81 Q_REVISION(2, 5) void rightInsetChanged();
82 Q_REVISION(2, 5) void bottomInsetChanged();
83
84protected:
85 void classBegin() override;
86 void componentComplete() override;
87
88 void itemChange(ItemChange change, const ItemChangeData &value) override;
89 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
90 virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
91
92private:
93 Q_DISABLE_COPY(QQuickLabel)
94 Q_DECLARE_PRIVATE(QQuickLabel)
95};
96
97QT_END_NAMESPACE
98
99#endif // QQUICKLABEL_P_H
static bool isKeyFocusReason(Qt::FocusReason reason)
static QString contentItemName()