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
qquicktextarea_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 QQUICKTEXTAREA_P_H
6#define QQUICKTEXTAREA_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/qquicktextedit_p.h>
21#include <QtQuick/private/qquickevents_p_p.h>
22#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
23
25
26class QQuickText;
28class QQuickTextAreaAttached;
29
30class Q_QUICKTEMPLATES2_EXPORT QQuickTextArea : public QQuickTextEdit
31{
32 Q_OBJECT
33 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
34 Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged3 FINAL)
35 Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged3 FINAL)
36 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
37 Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
38 Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
39 // 2.1 (Qt 5.8)
40 Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION(2, 1))
41 Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION(2, 1))
42 // 2.5 (Qt 5.12)
43 Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION(2, 5))
44 Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION(2, 5))
45 Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION(2, 5))
46 Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION(2, 5))
47 Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION(2, 5))
48 Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION(2, 5))
49 Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION(2, 5))
50 Q_CLASSINFO("DeferredPropertyNames", "background")
51 QML_NAMED_ELEMENT(TextArea)
52 QML_ATTACHED(QQuickTextAreaAttached)
53 QML_ADDED_IN_VERSION(2, 0)
54
55public:
56 explicit QQuickTextArea(QQuickItem *parent = nullptr);
57 ~QQuickTextArea();
58
59 static QQuickTextAreaAttached *qmlAttachedProperties(QObject *object);
60
61 QFont font() const;
62 void setFont(const QFont &font);
63
64 QQuickItem *background() const;
65 void setBackground(QQuickItem *background);
66
67 QString placeholderText() const;
68 void setPlaceholderText(const QString &text);
69
70 Qt::FocusReason focusReason() const;
71 void setFocusReason(Qt::FocusReason reason);
72
73 bool contains(const QPointF &point) const override;
74
75 // 2.1 (Qt 5.8)
76 bool isHovered() const;
77 void setHovered(bool hovered);
78
79 bool isHoverEnabled() const;
80 void setHoverEnabled(bool enabled);
81 void resetHoverEnabled();
82
83 // 2.5 (Qt 5.12)
84 QColor placeholderTextColor() const;
85 void setPlaceholderTextColor(const QColor &color);
86
87 qreal implicitBackgroundWidth() const;
88 qreal implicitBackgroundHeight() const;
89
90 qreal topInset() const;
91 void setTopInset(qreal inset);
92 void resetTopInset();
93
94 qreal leftInset() const;
95 void setLeftInset(qreal inset);
96 void resetLeftInset();
97
98 qreal rightInset() const;
99 void setRightInset(qreal inset);
100 void resetRightInset();
101
102 qreal bottomInset() const;
103 void setBottomInset(qreal inset);
104 void resetBottomInset();
105
106Q_SIGNALS:
107 void fontChanged();
108 void implicitWidthChanged3();
109 void implicitHeightChanged3();
110 void backgroundChanged();
111 void placeholderTextChanged();
112 void focusReasonChanged();
113 void pressAndHold(QQuickMouseEvent *event);
114 // 2.1 (Qt 5.8)
115 Q_REVISION(2, 1) void pressed(QQuickMouseEvent *event);
116 Q_REVISION(2, 1) void released(QQuickMouseEvent *event);
117 Q_REVISION(2, 1) void hoveredChanged();
118 Q_REVISION(2, 1) void hoverEnabledChanged();
119 // 2.5 (Qt 5.12)
120 Q_REVISION(2, 5) void placeholderTextColorChanged();
121 Q_REVISION(2, 5) void implicitBackgroundWidthChanged();
122 Q_REVISION(2, 5) void implicitBackgroundHeightChanged();
123 Q_REVISION(2, 5) void topInsetChanged();
124 Q_REVISION(2, 5) void leftInsetChanged();
125 Q_REVISION(2, 5) void rightInsetChanged();
126 Q_REVISION(2, 5) void bottomInsetChanged();
127
128protected:
129 friend struct QQuickPressHandler;
130
131 void classBegin() override;
132 void componentComplete() override;
133
134 void itemChange(ItemChange change, const ItemChangeData &value) override;
135 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
136 virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
137
138 QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
139
140 void focusInEvent(QFocusEvent *event) override;
141 void focusOutEvent(QFocusEvent *event) override;
142#if QT_CONFIG(quicktemplates2_hover)
143 void hoverEnterEvent(QHoverEvent *event) override;
144 void hoverLeaveEvent(QHoverEvent *event) override;
145#endif
146 void mousePressEvent(QMouseEvent *event) override;
147 void mouseMoveEvent(QMouseEvent *event) override;
148 void mouseReleaseEvent(QMouseEvent *event) override;
149 void mouseDoubleClickEvent(QMouseEvent *event) override;
150 void timerEvent(QTimerEvent *event) override;
151
152private:
153 Q_DISABLE_COPY(QQuickTextArea)
154 Q_DECLARE_PRIVATE(QQuickTextArea)
155};
156
158
159class Q_QUICKTEMPLATES2_EXPORT QQuickTextAreaAttached : public QObject
160{
161 Q_OBJECT
162 Q_PROPERTY(QQuickTextArea *flickable READ flickable WRITE setFlickable NOTIFY flickableChanged FINAL)
163
164public:
165 explicit QQuickTextAreaAttached(QObject *parent);
166
167 QQuickTextArea *flickable() const;
168 void setFlickable(QQuickTextArea *control);
169
170Q_SIGNALS:
171 void flickableChanged();
172
173private:
174 Q_DISABLE_COPY(QQuickTextAreaAttached)
175 Q_DECLARE_PRIVATE(QQuickTextAreaAttached)
176};
177
178QT_END_NAMESPACE
179
180#endif // QQUICKTEXTAREA_P_H
static bool isKeyFocusReason(Qt::FocusReason reason)
static QString contentItemName()