10#include <QtQuick/private/qquickitem_p.h>
11#include <QtQuick/private/qquicktextinput_p.h>
12#include <QtQuick/private/qquickclipnode_p.h>
14#if QT_CONFIG(accessibility)
15#include <QtQuick/private/qquickaccessibleattached_p.h>
88#if QT_CONFIG(accessibility)
89 QAccessible::installActivationObserver(
this);
95#if QT_CONFIG(accessibility)
96 QAccessible::removeActivationObserver(
this);
107 emit q->topInsetChanged();
119 emit q->leftInsetChanged();
131 emit q->rightInsetChanged();
143 emit q->bottomInsetChanged();
157 || (
extra.isAllocated() && (
extra->hasLeftInset ||
extra->hasRightInset))) {
158 const bool wasWidthValid =
p->widthValid();
163 p->widthValidFlag =
false;
166 || (
extra.isAllocated() && (
extra->hasTopInset ||
extra->hasBottomInset))) {
167 const bool wasHeightValid =
p->heightValid();
171 p->heightValidFlag =
false;
211 q->QQuickTextInput::setFont(
font);
216 emit q->fontChanged();
219#if QT_CONFIG(quicktemplates2_hover)
220void QQuickTextFieldPrivate::updateHoverEnabled(
bool enabled,
bool xplicit)
223 if (!xplicit && explicitHoverEnabled)
226 bool wasEnabled =
q->isHoverEnabled();
227 explicitHoverEnabled = xplicit;
230 QQuickControlPrivate::updateHoverEnabledRecur(
q,
enabled);
231 emit q->hoverEnabledChanged();
250 emit q->implicitWidthChanged3();
257 emit q->implicitHeightChanged3();
263#if QT_CONFIG(accessibility)
264 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q_func()))
265 accessibleAttached->set_readOnly(isReadOnly);
274#if QT_CONFIG(accessibility)
275 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q_func()))
282#if QT_CONFIG(accessibility)
283void QQuickTextFieldPrivate::accessibilityActiveChanged(
bool active)
289 QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(
q,
true));
291 accessibleAttached->setRole(effectiveAccessibleRole());
297QAccessible::Role QQuickTextFieldPrivate::accessibleRole()
const
299 return QAccessible::EditableText;
331 if (
p->widthValid() ||
extra.isAllocated())
332 extra.value().hasBackgroundWidth =
p->widthValid();
333 if (
p->heightValid() ||
extra.isAllocated())
334 extra.value().hasBackgroundHeight =
p->heightValid();
342 emit q->implicitBackgroundWidthChanged();
349 emit q->implicitBackgroundHeightChanged();
357 emit q->implicitBackgroundWidthChanged();
358 emit q->implicitBackgroundHeightChanged();
371 d->pressHandler.control =
this;
372 d->setImplicitResizeEnabled(
false);
380#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
382 QQuickTextInput::setOldSelectionDefault();
404 if (
d->extra.value().requestedFont.resolveMask() ==
font.
resolveMask() &&
d->extra.value().requestedFont ==
font)
407 d->extra.value().requestedFont =
font;
424 d->executeBackground();
425 return d->background;
436 if (!
d->background.isExecuting())
437 d->cancelBackground();
442 if (
d->extra.isAllocated()) {
443 d->extra.value().hasBackgroundWidth =
false;
444 d->extra.value().hasBackgroundHeight =
false;
456 if (
p->widthValid() ||
p->heightValid()) {
457 d->extra.value().hasBackgroundWidth =
p->widthValid();
458 d->extra.value().hasBackgroundHeight =
p->heightValid();
461 d->resizeBackground();
466 emit implicitBackgroundWidthChanged();
468 emit implicitBackgroundHeightChanged();
469 if (!
d->background.isExecuting())
482 return d->placeholder;
488 if (
d->placeholder ==
text)
491 d->placeholder =
text;
492#if QT_CONFIG(accessibility)
494 accessibleAttached->setDescription(
text);
510 return d->placeholderColor;
516 if (
d->placeholderColor ==
color)
519 d->placeholderColor =
color;
520 emit placeholderTextColorChanged();
531 return d->focusReason;
537 if (
d->focusReason == reason)
540 d->focusReason = reason;
555#if QT_CONFIG(quicktemplates2_hover)
565#if QT_CONFIG(quicktemplates2_hover)
571 emit hoveredChanged();
587#if QT_CONFIG(quicktemplates2_hover)
589 return d->hoverEnabled;
597#if QT_CONFIG(quicktemplates2_hover)
599 if (
d->explicitHoverEnabled &&
enabled ==
d->hoverEnabled)
602 d->updateHoverEnabled(
enabled,
true);
610#if QT_CONFIG(quicktemplates2_hover)
612 if (!
d->explicitHoverEnabled)
615 d->explicitHoverEnabled =
false;
616 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(
d->parentItem),
false);
643 return d->background->implicitWidth();
662 return d->background->implicitHeight();
676 return d->getTopInset();
682 d->setTopInset(inset);
688 d->setTopInset(0,
true);
702 return d->getLeftInset();
708 d->setLeftInset(inset);
714 d->setLeftInset(0,
true);
728 return d->getRightInset();
734 d->setRightInset(inset);
740 d->setRightInset(0,
true);
754 return d->getBottomInset();
760 d->setBottomInset(inset);
766 d->setBottomInset(0,
true);
772 d->executeBackground(
true);
774 d->resizeBackground();
775#if QT_CONFIG(quicktemplates2_hover)
776 if (!
d->explicitHoverEnabled)
779#if QT_CONFIG(accessibility)
780 if (QAccessible::isActive())
781 d->accessibilityActiveChanged(
true);
796#if QT_CONFIG(quicktemplates2_hover)
797 if (!
d->explicitHoverEnabled)
798 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(
d->parentItem),
false);
811 d->resizeBackground();
819 d->resizeBackground();
849#if QT_CONFIG(quicktemplates2_hover)
869 d->pressHandler.mousePressEvent(
event);
870 if (
d->pressHandler.isActive()) {
871 if (
d->pressHandler.delayedMousePressEvent) {
873 d->pressHandler.clearDelayedMouseEvent();
883 d->pressHandler.mouseMoveEvent(
event);
884 if (
d->pressHandler.isActive()) {
885 if (
d->pressHandler.delayedMousePressEvent) {
887 d->pressHandler.clearDelayedMouseEvent();
890 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
891 ||
d->selectByTouchDrag
902 d->pressHandler.mouseReleaseEvent(
event);
903 if (
d->pressHandler.isActive()) {
904 if (
d->pressHandler.delayedMousePressEvent) {
906 d->pressHandler.clearDelayedMouseEvent();
916 if (
d->pressHandler.delayedMousePressEvent) {
918 d->pressHandler.clearDelayedMouseEvent();
927 if (
event->timerId() ==
d->pressHandler.timer.timerId())
928 d->pressHandler.timerEvent(
event);
935#include "moc_qquicktextfield_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
The QFocusEvent class contains event parameters for widget focus events.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
void setResolveMask(uint mask)
constexpr qreal right() const noexcept
Returns the right margin.
constexpr qreal left() const noexcept
Returns the left margin.
constexpr qreal top() const noexcept
Returns the top margin.
constexpr qreal bottom() const noexcept
Returns the bottom margin.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
The QPalette class contains color groups for each widget state.
virtual void classBegin()=0
Invoked after class creation, but before any properties have been set.
void removeImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
static const ChangeTypes ImplicitSizeChanges
Abstract base type providing functionality common to all controls.
void addImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
static void hideOldItem(QQuickItem *item)
static QFont parentFont(const QQuickItem *item)
static void warnIfCustomizationNotSupported(QObject *control, QQuickItem *item, const QString &propertyName)
static void updateFontRecur(QQuickItem *item, const QFont &font)
void setRect(const QRectF &)
static bool isEventFromMouseOrTouchpad(const QPointerEvent *ev)
virtual void implicitHeightChanged()
virtual qreal getImplicitWidth() const
virtual qreal getImplicitHeight() const
static QQuickItemPrivate * get(QQuickItem *item)
virtual void implicitWidthChanged()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
void setAcceptHoverEvents(bool enabled)
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accept...
qreal y
Defines the item's y position relative to its parent.
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
friend class QQuickAccessibleAttached
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setActiveFocusOnTab(bool)
void executeBackground(bool complete=false)
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
void echoModeChanged(QQuickTextField::EchoMode echoMode)
qreal getImplicitHeight() const override
void setBottomInset(qreal value, bool reset=false)
~QQuickTextFieldPrivate()
void inheritFont(const QFont &font)
QQuickDeferredPointer< QQuickItem > background
void setRightInset(qreal value, bool reset=false)
void itemImplicitWidthChanged(QQuickItem *item) override
QMarginsF getInset() const
void readOnlyChanged(bool isReadOnly)
qreal getBottomInset() const
void itemImplicitHeightChanged(QQuickItem *item) override
void setLeftInset(qreal value, bool reset=false)
qreal getImplicitWidth() const override
qreal getTopInset() const
QQuickTextFieldPrivate()
Single-line text input field.
void setFont_helper(const QFont &font)
void implicitHeightChanged() override
void setTopInset(qreal value, bool reset=false)
void itemDestroyed(QQuickItem *item) override
void implicitWidthChanged() override
qreal getLeftInset() const
QLazilyAllocated< ExtraData > extra
void updateFont(const QFont &font)
qreal getRightInset() const
QPalette defaultPalette() const override
void setFont(const QFont &font)
void focusOutEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void focusReasonChanged()
void mouseMoveEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void setTopInset(qreal inset)
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
void setBackground(QQuickItem *background)
void mouseDoubleClickEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void setBottomInset(qreal inset)
void mouseReleaseEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void setPlaceholderTextColor(const QColor &color)
QQuickTextField(QQuickItem *parent=nullptr)
void setHoverEnabled(bool enabled)
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
qreal implicitBackgroundHeight
void placeholderTextChanged()
void setPlaceholderText(const QString &text)
void setHovered(bool hovered)
void setLeftInset(qreal inset)
bool isHoverEnabled() const
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
qreal implicitBackgroundWidth
Qt::FocusReason focusReason
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void setFocusReason(Qt::FocusReason reason)
void setRightInset(qreal inset)
QColor placeholderTextColor
virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
QQuickTextInput::EchoMode m_echoMode
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
QRectF clipRect() const override
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
void mouseReleaseEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
void focusOutEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void readOnlyChanged(bool isReadOnly)
void echoModeChanged(QQuickTextInput::EchoMode echoMode)
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void mouseDoubleClickEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
void mouseMoveEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\inmodule QtCore\reentrant
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
QSGNode * parent() const
Returns the parent node of this node.
QSGNode * firstChild() const
Returns the first child of this node.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
void quickCancelDeferred(QObject *object, const QString &property)
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
#define QStringLiteral(str)
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
static QString backgroundName()
item setCursor(Qt::IBeamCursor)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent