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;
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();
545 return d->lastFocusChangeReason();
551 d->setLastFocusChangeReason(reason);
566#if QT_CONFIG(quicktemplates2_hover)
576#if QT_CONFIG(quicktemplates2_hover)
582 emit hoveredChanged();
598#if QT_CONFIG(quicktemplates2_hover)
600 return d->hoverEnabled;
608#if QT_CONFIG(quicktemplates2_hover)
610 if (
d->explicitHoverEnabled &&
enabled ==
d->hoverEnabled)
613 d->updateHoverEnabled(
enabled,
true);
621#if QT_CONFIG(quicktemplates2_hover)
623 if (!
d->explicitHoverEnabled)
626 d->explicitHoverEnabled =
false;
627 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(
d->parentItem),
false);
654 return d->background->implicitWidth();
673 return d->background->implicitHeight();
687 return d->getTopInset();
693 d->setTopInset(inset);
699 d->setTopInset(0,
true);
713 return d->getLeftInset();
719 d->setLeftInset(inset);
725 d->setLeftInset(0,
true);
739 return d->getRightInset();
745 d->setRightInset(inset);
751 d->setRightInset(0,
true);
765 return d->getBottomInset();
771 d->setBottomInset(inset);
777 d->setBottomInset(0,
true);
783 d->executeBackground(
true);
785 d->resizeBackground();
786#if QT_CONFIG(quicktemplates2_hover)
787 if (!
d->explicitHoverEnabled)
790#if QT_CONFIG(accessibility)
791 if (QAccessible::isActive())
792 d->accessibilityActiveChanged(
true);
807#if QT_CONFIG(quicktemplates2_hover)
808 if (!
d->explicitHoverEnabled)
809 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(
d->parentItem),
false);
822 d->resizeBackground();
830 d->resizeBackground();
858#if QT_CONFIG(quicktemplates2_hover)
878 d->pressHandler.mousePressEvent(
event);
879 if (
d->pressHandler.isActive()) {
880 if (
d->pressHandler.delayedMousePressEvent) {
882 d->pressHandler.clearDelayedMouseEvent();
892 d->pressHandler.mouseMoveEvent(
event);
893 if (
d->pressHandler.isActive()) {
894 if (
d->pressHandler.delayedMousePressEvent) {
896 d->pressHandler.clearDelayedMouseEvent();
899 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
900 ||
d->selectByTouchDrag
911 d->pressHandler.mouseReleaseEvent(
event);
912 if (
d->pressHandler.isActive()) {
913 if (
d->pressHandler.delayedMousePressEvent) {
915 d->pressHandler.clearDelayedMouseEvent();
925 if (
d->pressHandler.delayedMousePressEvent) {
927 d->pressHandler.clearDelayedMouseEvent();
936 if (
event->timerId() ==
d->pressHandler.timer.timerId())
937 d->pressHandler.timerEvent(
event);
944#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)
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.
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.
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
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
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
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]