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
qquicktextfield_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 QQUICKTEXTFIELD_P_H
6#define QQUICKTEXTFIELD_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/qquicktextinput_p.h>
21#include <QtQuick/private/qquickevents_p_p.h>
22#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
23
25
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickTextField : public QQuickTextInput
29{
30 Q_OBJECT
31 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
32 Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged3 FINAL)
33 Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged3 FINAL)
34 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
35 Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
36 Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
37 // 2.1 (Qt 5.8)
38 Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION(2, 1))
39 Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION(2, 1))
40 // 2.5 (Qt 5.12)
41 Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION(2, 5))
42 Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION(2, 5))
43 Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION(2, 5))
44 Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION(2, 5))
45 Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION(2, 5))
46 Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION(2, 5))
47 Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION(2, 5))
48 Q_CLASSINFO("DeferredPropertyNames", "background")
49 QML_NAMED_ELEMENT(TextField)
50 QML_ADDED_IN_VERSION(2, 0)
51
52public:
53 explicit QQuickTextField(QQuickItem *parent = nullptr);
54 ~QQuickTextField();
55
56 QFont font() const;
57 void setFont(const QFont &font);
58
59 QQuickItem *background() const;
60 void setBackground(QQuickItem *background);
61
62 QString placeholderText() const;
63 void setPlaceholderText(const QString &text);
64
65 Qt::FocusReason focusReason() const;
66 void setFocusReason(Qt::FocusReason reason);
67
68 // 2.1 (Qt 5.8)
69 bool isHovered() const;
70 void setHovered(bool hovered);
71
72 bool isHoverEnabled() const;
73 void setHoverEnabled(bool enabled);
74 void resetHoverEnabled();
75
76 // 2.5 (Qt 5.12)
77 QColor placeholderTextColor() const;
78 void setPlaceholderTextColor(const QColor &color);
79
80 qreal implicitBackgroundWidth() const;
81 qreal implicitBackgroundHeight() const;
82
83 qreal topInset() const;
84 void setTopInset(qreal inset);
85 void resetTopInset();
86
87 qreal leftInset() const;
88 void setLeftInset(qreal inset);
89 void resetLeftInset();
90
91 qreal rightInset() const;
92 void setRightInset(qreal inset);
93 void resetRightInset();
94
95 qreal bottomInset() const;
96 void setBottomInset(qreal inset);
97 void resetBottomInset();
98
99Q_SIGNALS:
100 void fontChanged();
101 void implicitWidthChanged3();
102 void implicitHeightChanged3();
103 void backgroundChanged();
104 void placeholderTextChanged();
105 void focusReasonChanged();
106 void pressAndHold(QQuickMouseEvent *event);
107 // 2.1 (Qt 5.8)
108 Q_REVISION(2, 1) void pressed(QQuickMouseEvent *event);
109 Q_REVISION(2, 1) void released(QQuickMouseEvent *event);
110 Q_REVISION(2, 1) void hoveredChanged();
111 Q_REVISION(2, 1) void hoverEnabledChanged();
112 // 2.5 (Qt 5.12)
113 Q_REVISION(2, 5) void placeholderTextColorChanged();
114 Q_REVISION(2, 5) void implicitBackgroundWidthChanged();
115 Q_REVISION(2, 5) void implicitBackgroundHeightChanged();
116 Q_REVISION(2, 5) void topInsetChanged();
117 Q_REVISION(2, 5) void leftInsetChanged();
118 Q_REVISION(2, 5) void rightInsetChanged();
119 Q_REVISION(2, 5) void bottomInsetChanged();
120
121protected:
122 friend struct QQuickPressHandler;
123
124 void classBegin() override;
125 void componentComplete() override;
126
127 void itemChange(ItemChange change, const ItemChangeData &value) override;
128 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
129 virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
130
131 QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
132
133 void focusInEvent(QFocusEvent *event) override;
134 void focusOutEvent(QFocusEvent *event) override;
135#if QT_CONFIG(quicktemplates2_hover)
136 void hoverEnterEvent(QHoverEvent *event) override;
137 void hoverLeaveEvent(QHoverEvent *event) override;
138#endif
139 void mousePressEvent(QMouseEvent *event) override;
140 void mouseMoveEvent(QMouseEvent *event) override;
141 void mouseReleaseEvent(QMouseEvent *event) override;
142 void mouseDoubleClickEvent(QMouseEvent *event) override;
143 void timerEvent(QTimerEvent *event) override;
144
145private:
146 Q_DISABLE_COPY(QQuickTextField)
147 Q_DECLARE_PRIVATE(QQuickTextField)
148};
149
150QT_END_NAMESPACE
151
152#endif // QQUICKTEXTFIELD_P_H
void readOnlyChanged(bool isReadOnly)
void implicitWidthChanged() override
qreal getImplicitWidth() const override
bool setLastFocusChangeReason(Qt::FocusReason reason) override
void setFont_helper(const QFont &font)
QQuickFlickable * flickable
QQuickDeferredPointer< QQuickItem > background
void setTopInset(qreal value, bool reset=false)
void setLeftInset(qreal value, bool reset=false)
void setRightInset(qreal value, bool reset=false)
void executeBackground(bool complete=false)
QLazilyAllocated< ExtraData > extra
void updateFont(const QFont &font)
void setBottomInset(qreal value, bool reset=false)
void itemDestroyed(QQuickItem *item) override
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
void itemImplicitWidthChanged(QQuickItem *item) override
void attachFlickable(QQuickFlickable *flickable)
void inheritFont(const QFont &font)
qreal getImplicitHeight() const override
QQuickPressHandler pressHandler
void itemImplicitHeightChanged(QQuickItem *item) override
QMarginsF getInset() const
static QQuickTextAreaPrivate * get(QQuickTextArea *item)
QPalette defaultPalette() const override
void implicitHeightChanged() override
static bool isKeyFocusReason(Qt::FocusReason reason)
static QString contentItemName()