Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicktextarea.cpp
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
4#include "qquicktextarea_p.h"
6#include "qquickcontrol_p.h"
7#include "qquickcontrol_p_p.h"
10
11#include <QtQml/qqmlinfo.h>
12#include <QtQuick/private/qquickitem_p.h>
13#include <QtQuick/private/qquickclipnode_p.h>
14#include <QtQuick/private/qquickflickable_p.h>
15
16#if QT_CONFIG(accessibility)
17#include <QtQuick/private/qquickaccessibleattached_p.h>
18#endif
19
21
22using namespace Qt::StringLiterals;
23
28
125
129
131{
132 Q_Q(QQuickTextArea);
133 const QMarginsF oldInset = getInset();
134 extra.value().topInset = value;
135 extra.value().hasTopInset = !reset;
136 if (!qFuzzyCompare(oldInset.top(), value)) {
137 emit q->topInsetChanged();
138 q->insetChange(getInset(), oldInset);
139 }
140}
141
143{
144 Q_Q(QQuickTextArea);
145 const QMarginsF oldInset = getInset();
146 extra.value().leftInset = value;
147 extra.value().hasLeftInset = !reset;
148 if (!qFuzzyCompare(oldInset.left(), value)) {
149 emit q->leftInsetChanged();
150 q->insetChange(getInset(), oldInset);
151 }
152}
153
155{
156 Q_Q(QQuickTextArea);
157 const QMarginsF oldInset = getInset();
158 extra.value().rightInset = value;
159 extra.value().hasRightInset = !reset;
160 if (!qFuzzyCompare(oldInset.right(), value)) {
161 emit q->rightInsetChanged();
162 q->insetChange(getInset(), oldInset);
163 }
164}
165
167{
168 Q_Q(QQuickTextArea);
169 const QMarginsF oldInset = getInset();
170 extra.value().bottomInset = value;
171 extra.value().hasBottomInset = !reset;
172 if (!qFuzzyCompare(oldInset.bottom(), value)) {
173 emit q->bottomInsetChanged();
174 q->insetChange(getInset(), oldInset);
175 }
176}
177
179{
180 if (!background)
181 return;
182
183 resizingBackground = true;
184
185 // When using the attached property TextArea.flickable, we reparent the background out
186 // of TextArea and into the Flickable since we don't want the background to move while
187 // flicking. This means that the size of the background should also follow the size of
188 // the Flickable rather than the size of the TextArea.
189 const auto flickable = qobject_cast<QQuickFlickable *>(background->parentItem());
190
192 if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
193 || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
194 const qreal bgWidth = flickable ? flickable->width() : width;
197 }
198
199 if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
200 || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
201 const qreal bgHeight = flickable ? flickable->height() : height;
204 }
205
206 resizingBackground = false;
207}
208
222
224{
225 QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
226 parentFont.setResolveMask(extra.isAllocated() ? extra->requestedFont.resolveMask() | font.resolveMask() : font.resolveMask());
227
228 const QFont defaultFont = QQuickTheme::font(QQuickTheme::TextArea);
229 QFont resolvedFont = parentFont.resolve(defaultFont);
230
231 setFont_helper(resolvedFont);
232}
233
240{
241 Q_Q(QQuickTextArea);
242 QFont oldFont = sourceFont;
243 q->QQuickTextEdit::setFont(font);
244
246
247 if (oldFont != font)
248 emit q->fontChanged();
249}
250
251#if QT_CONFIG(quicktemplates2_hover)
252void QQuickTextAreaPrivate::updateHoverEnabled(bool enabled, bool xplicit)
253{
254 Q_Q(QQuickTextArea);
255 if (!xplicit && explicitHoverEnabled)
256 return;
257
258 bool wasEnabled = q->isHoverEnabled();
259 explicitHoverEnabled = xplicit;
260 if (wasEnabled != enabled) {
261 q->setAcceptHoverEvents(enabled);
262 QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
263 emit q->hoverEnabledChanged();
264 }
265}
266#endif
267
290
313
315{
316 Q_Q(QQuickTextArea);
317 if (!flickable)
318 return;
319
320 const qreal cx = flickable->contentX();
321 const qreal cy = flickable->contentY();
322 const qreal w = flickable->width();
323 const qreal h = flickable->height();
324
325 const qreal tp = q->topPadding();
326 const qreal lp = q->leftPadding();
327 const QRectF cr = q->cursorRectangle();
328
329 if (cr.left() <= cx + lp) {
330 flickable->setContentX(cr.left() - lp);
331 } else {
332 // calculate the rectangle of the next character and ensure that
333 // it's visible if it's on the same line with the cursor
334 const qreal rp = q->rightPadding();
335 const QRectF nr = q->cursorPosition() < q->length() ? q->positionToRectangle(q->cursorPosition() + 1) : QRectF();
336 if (qFuzzyCompare(nr.y(), cr.y()) && nr.right() >= cx + lp + w - rp)
337 flickable->setContentX(nr.right() - w + rp);
338 else if (cr.right() >= cx + lp + w - rp)
339 flickable->setContentX(cr.right() - w + rp);
340 }
341
342 if (cr.top() <= cy + tp) {
343 flickable->setContentY(cr.top() - tp);
344 } else {
345 const qreal bp = q->bottomPadding();
346 if (cr.bottom() >= cy + tp + h - bp && cr.bottom() <= flickable->contentHeight())
347 flickable->setContentY(cr.bottom() - h + bp);
348 }
349}
350
352{
353 Q_Q(QQuickTextArea);
354 if (!flickable)
355 return;
356
359 q->setSize(QSizeF(w, h));
360
362}
363
365{
366 Q_Q(QQuickTextArea);
367 if (!flickable)
368 return;
369
370 flickable->setContentWidth(q->implicitWidth());
371 flickable->setContentHeight(q->implicitHeight());
372}
373
375{
376 Q_UNUSED(diff);
379 // Only set hasBackgroundWidth/Height if it was a width/height change,
380 // otherwise we're prevented from setting a width/height in the future.
381 if (change.widthChange())
382 extra.value().hasBackgroundWidth = p->widthValid();
383 if (change.heightChange())
384 extra.value().hasBackgroundHeight = p->heightValid();
385 }
386
387 if (flickable)
389 else
391}
392
397
402
409
416
417#if QT_CONFIG(accessibility)
418void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active)
419{
420 QQuickTextEditPrivate::accessibilityActiveChanged(active);
421 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q_func()))
422 accessibleAttached->setDescription(placeholder);
423}
424#endif
425
431
433{
434 Q_Q(QQuickTextArea);
436 return;
437
438 if (!background || complete)
440 if (complete)
442}
443
445{
446 Q_Q(QQuickTextArea);
447 if (item == background)
448 emit q->implicitBackgroundWidthChanged();
449}
450
452{
453 Q_Q(QQuickTextArea);
454 if (item == background)
455 emit q->implicitBackgroundHeightChanged();
456}
457
459{
460 Q_Q(QQuickTextArea);
461 if (item == background) {
462 background = nullptr;
463 emit q->implicitBackgroundWidthChanged();
464 emit q->implicitBackgroundHeightChanged();
465 } else if (item == flickable) {
467 }
468}
469
474
476 : QQuickTextEdit(*(new QQuickTextAreaPrivate), parent)
477{
478 Q_D(QQuickTextArea);
481 d->setImplicitResizeEnabled(false);
482 d->pressHandler.control = this;
483
484#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
485 if (qEnvironmentVariable("QT_QUICK_CONTROLS_TEXT_SELECTION_BEHAVIOR") == u"old"_s)
486 QQuickTextEdit::setOldSelectionDefault();
487#endif
488}
489
497
502
504{
505 Q_D(const QQuickTextArea);
507 // The resolve mask should inherit from the requestedFont
508 font.setResolveMask(d->extra.value().requestedFont.resolveMask());
509 return font;
510}
511
513{
514 Q_D(QQuickTextArea);
515 if (d->extra.value().requestedFont.resolveMask() == font.resolveMask() && d->extra.value().requestedFont == font)
516 return;
517
518 d->extra.value().requestedFont = font;
519 d->resolveFont();
520}
521
532{
533 QQuickTextAreaPrivate *d = const_cast<QQuickTextAreaPrivate *>(d_func());
534 if (!d->background)
536 return d->background;
537}
538
540{
541 Q_D(QQuickTextArea);
542 if (d->background == background)
543 return;
544
546
547 if (!d->background.isExecuting())
548 d->cancelBackground();
549
550 const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
551 const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
552
553 if (d->extra.isAllocated()) {
554 d->extra.value().hasBackgroundWidth = false;
555 d->extra.value().hasBackgroundHeight = false;
556 }
557
560 d->background = background;
561
562 if (background) {
564 if (p->widthValid() || p->heightValid()) {
565 d->extra.value().hasBackgroundWidth = p->widthValid();
566 d->extra.value().hasBackgroundHeight = p->heightValid();
567 }
568 if (d->flickable)
569 background->setParentItem(d->flickable);
570 else
572 if (qFuzzyIsNull(background->z()))
573 background->setZ(-1);
575 d->resizeBackground();
577 }
578
579 if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
580 emit implicitBackgroundWidthChanged();
581 if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
582 emit implicitBackgroundHeightChanged();
583 if (!d->background.isExecuting())
585}
586
594{
595 Q_D(const QQuickTextArea);
596 return d->placeholder;
597}
598
600{
601 Q_D(QQuickTextArea);
602 if (d->placeholder == text)
603 return;
604
605 d->placeholder = text;
606#if QT_CONFIG(accessibility)
607 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
608 accessibleAttached->setDescription(text);
609#endif
611}
612
622{
623 Q_D(const QQuickTextArea);
624 return d->placeholderColor;
625}
626
628{
629 Q_D(QQuickTextArea);
630 if (d->placeholderColor == color)
631 return;
632
633 d->placeholderColor = color;
634 emit placeholderTextColorChanged();
635}
636
657{
658 Q_D(const QQuickTextArea);
659 return d->lastFocusChangeReason();
660}
661
663{
664 Q_D(QQuickTextArea);
665 d->setLastFocusChangeReason(reason);
667}
668
669
670bool QQuickTextArea::contains(const QPointF &point) const
671{
672 Q_D(const QQuickTextArea);
673 if (d->flickable && !d->flickable->contains(d->flickable->mapFromItem(this, point)))
674 return false;
675 return QQuickTextEdit::contains(point);
676}
677
688{
689#if QT_CONFIG(quicktemplates2_hover)
690 Q_D(const QQuickTextArea);
691 return d->hovered;
692#else
693 return false;
694#endif
695}
696
698{
699#if QT_CONFIG(quicktemplates2_hover)
700 Q_D(QQuickTextArea);
701 if (hovered == d->hovered)
702 return;
703
704 d->hovered = hovered;
705 emit hoveredChanged();
706#else
708#endif
709}
710
720{
721#if QT_CONFIG(quicktemplates2_hover)
722 Q_D(const QQuickTextArea);
723 return d->hoverEnabled;
724#else
725 return false;
726#endif
727}
728
730{
731#if QT_CONFIG(quicktemplates2_hover)
732 Q_D(QQuickTextArea);
733 if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
734 return;
735
736 d->updateHoverEnabled(enabled, true); // explicit=true
737#else
739#endif
740}
741
743{
744#if QT_CONFIG(quicktemplates2_hover)
745 Q_D(QQuickTextArea);
746 if (!d->explicitHoverEnabled)
747 return;
748
749 d->explicitHoverEnabled = false;
750 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
751#endif
752}
753
766{
767 Q_D(const QQuickTextArea);
768 if (!d->background)
769 return 0;
770 return d->background->implicitWidth();
771}
772
785{
786 Q_D(const QQuickTextArea);
787 if (!d->background)
788 return 0;
789 return d->background->implicitHeight();
790}
791
801{
802 Q_D(const QQuickTextArea);
803 return d->getTopInset();
804}
805
807{
808 Q_D(QQuickTextArea);
809 d->setTopInset(inset);
810}
811
813{
814 Q_D(QQuickTextArea);
815 d->setTopInset(0, true);
816}
817
827{
828 Q_D(const QQuickTextArea);
829 return d->getLeftInset();
830}
831
833{
834 Q_D(QQuickTextArea);
835 d->setLeftInset(inset);
836}
837
839{
840 Q_D(QQuickTextArea);
841 d->setLeftInset(0, true);
842}
843
853{
854 Q_D(const QQuickTextArea);
855 return d->getRightInset();
856}
857
859{
860 Q_D(QQuickTextArea);
861 d->setRightInset(inset);
862}
863
865{
866 Q_D(QQuickTextArea);
867 d->setRightInset(0, true);
868}
869
879{
880 Q_D(const QQuickTextArea);
881 return d->getBottomInset();
882}
883
885{
886 Q_D(QQuickTextArea);
887 d->setBottomInset(inset);
888}
889
891{
892 Q_D(QQuickTextArea);
893 d->setBottomInset(0, true);
894}
895
897{
898 Q_D(QQuickTextArea);
900 d->resolveFont();
901}
902
904{
905 Q_D(QQuickTextArea);
906 d->executeBackground(true);
908 d->resizeBackground();
909#if QT_CONFIG(quicktemplates2_hover)
910 if (!d->explicitHoverEnabled)
911 setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
912#endif
913}
914
916{
917 Q_D(QQuickTextArea);
919 switch (change) {
921 break;
922 case ItemSceneChange:
924 if ((change == ItemParentHasChanged && value.item) || (change == ItemSceneChange && value.window)) {
925 d->resolveFont();
926#if QT_CONFIG(quicktemplates2_hover)
927 if (!d->explicitHoverEnabled)
928 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
929#endif
930 if (change == ItemParentHasChanged) {
931 QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(value.item->parentItem());
932 if (flickable) {
933 QQuickScrollView *scrollView = qobject_cast<QQuickScrollView *>(flickable->parentItem());
934 if (scrollView)
935 d->attachFlickable(flickable);
936 }
937 }
938 }
939 break;
940 default:
941 break;
942 }
943}
944
945void QQuickTextArea::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
946{
947 Q_D(QQuickTextArea);
948 QQuickTextEdit::geometryChange(newGeometry, oldGeometry);
949 d->resizeBackground();
950}
951
952void QQuickTextArea::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
953{
954 Q_D(QQuickTextArea);
955 Q_UNUSED(newInset);
956 Q_UNUSED(oldInset);
957 d->resizeBackground();
958}
959
961{
962 Q_D(QQuickTextArea);
963 QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
964 if (!clipNode)
965 clipNode = new QQuickDefaultClipNode(QRectF());
966
967 QQuickItem *clipper = this;
968 if (d->flickable)
969 clipper = d->flickable;
970
971 const QRectF cr = clipper->clipRect().adjusted(
973 (!d->cursorItem && effectiveHAlign() == HAlignment::AlignRight ? 1 : 0) - rightPadding(),
974 -bottomPadding());
975
976 clipNode->setRect(!d->flickable ? cr : cr.translated(d->flickable->contentX(), d->flickable->contentY()));
977 clipNode->update();
978
979 QSGNode *textNode = QQuickTextEdit::updatePaintNode(clipNode->firstChild(), data);
980 if (!textNode->parent())
981 clipNode->appendChildNode(textNode);
982
983 if (d->cursorItem) {
984 QQuickDefaultClipNode *cursorNode = QQuickItemPrivate::get(d->cursorItem)->clipNode();
985 if (cursorNode)
986 cursorNode->setClipRect(d->cursorItem->mapRectFromItem(clipper, cr));
987 }
988
989 return clipNode;
990}
991
996
1001
1002#if QT_CONFIG(quicktemplates2_hover)
1004{
1005 Q_D(QQuickTextArea);
1007 setHovered(d->hoverEnabled);
1008 event->ignore();
1009}
1010
1012{
1014 setHovered(false);
1015 event->ignore();
1016}
1017#endif
1018
1020{
1021 Q_D(QQuickTextArea);
1022 d->pressHandler.mousePressEvent(event);
1023 if (d->pressHandler.isActive()) {
1024 if (d->pressHandler.delayedMousePressEvent) {
1025 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1026 d->pressHandler.clearDelayedMouseEvent();
1027 }
1028 // Calling the base class implementation will result in QQuickTextControl's
1029 // press handler being called, which ignores events that aren't Qt::LeftButton.
1030 const bool wasAccepted = event->isAccepted();
1032 if (wasAccepted)
1033 event->accept();
1034 }
1035}
1036
1038{
1039 Q_D(QQuickTextArea);
1040 d->pressHandler.mouseMoveEvent(event);
1041 if (d->pressHandler.isActive()) {
1042 if (d->pressHandler.delayedMousePressEvent) {
1043 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1044 d->pressHandler.clearDelayedMouseEvent();
1045 }
1047 }
1048}
1049
1051{
1052 Q_D(QQuickTextArea);
1053 d->pressHandler.mouseReleaseEvent(event);
1054 if (d->pressHandler.isActive()) {
1055 if (d->pressHandler.delayedMousePressEvent) {
1056 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1057 d->pressHandler.clearDelayedMouseEvent();
1058 }
1060 }
1061}
1062
1064{
1065 Q_D(QQuickTextArea);
1066 if (d->pressHandler.delayedMousePressEvent) {
1067 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1068 d->pressHandler.clearDelayedMouseEvent();
1069 }
1071}
1072
1074{
1075 Q_D(QQuickTextArea);
1076 if (event->timerId() == d->pressHandler.timer.timerId())
1077 d->pressHandler.timerEvent(event);
1078 else
1080}
1081
1083{
1084public:
1086};
1087
1092
1101{
1102 Q_D(const QQuickTextAreaAttached);
1103 return d->control;
1104}
1105
1107{
1109 QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(parent());
1110 if (!flickable) {
1111 qmlWarning(parent()) << "TextArea must be attached to a Flickable";
1112 return;
1113 }
1114
1115 if (d->control == control)
1116 return;
1117
1118 if (d->control)
1119 QQuickTextAreaPrivate::get(d->control)->detachFlickable();
1120
1121 d->control = control;
1122
1123 if (control)
1124 QQuickTextAreaPrivate::get(control)->attachFlickable(flickable);
1125
1127}
1128
1130
1131#include "moc_qquicktextarea_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
\reentrant
Definition qfont.h:22
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition qfont.cpp:1893
void setResolveMask(uint mask)
Definition qfont.h:313
uint resolveMask() const
Definition qfont.h:312
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
\inmodule QtGui
Definition qevent.h:246
\inmodule QtCore
Definition qmargins.h:270
\inmodule QtGui
Definition qevent.h:196
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)
Definition qobject_p.h:299
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
Definition qobject_p.h:328
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
Definition qobject.cpp:1470
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
\inmodule QtCore\reentrant
Definition qpoint.h:217
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 &)
void contentXChanged()
void setContentWidth(qreal)
virtual void setContentX(qreal pos)
void contentYChanged()
void contentWidthChanged()
virtual void setContentY(qreal pos)
void contentHeightChanged()
QQuickItem * contentItem
void setContentHeight(qreal)
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}.
Definition qquickitem.h:63
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...
Definition qquickitem.h:72
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
Definition qquickitem.h:74
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.
Definition qquickitem.h:73
void setHeight(qreal)
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
qreal width
This property holds the width of this item.
Definition qquickitem.h:75
QQuickItem * parentItem() const
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal height
This property holds the height of this item.
Definition qquickitem.h:76
void setZ(qreal)
void setWidth(qreal)
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
@ ItemEnabledHasChanged
Definition qquickitem.h:155
@ ItemParentHasChanged
Definition qquickitem.h:149
friend class QQuickAccessibleAttached
Definition qquickitem.h:479
void setX(qreal)
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setY(qreal)
void update()
Schedules a call to updatePaintNode() for this item.
void setActiveFocusOnTab(bool)
void setFlickable(QQuickTextArea *control)
QQuickTextArea * flickable
QQuickTextAreaAttached(QObject *parent)
void implicitWidthChanged() override
qreal getImplicitWidth() const 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
void itemImplicitHeightChanged(QQuickItem *item) override
QMarginsF getInset() const
static QQuickTextAreaPrivate * get(QQuickTextArea *item)
QPalette defaultPalette() const override
void implicitHeightChanged() override
QQuickTextAreaPrivate()
Multi-line text input area.
void setTopInset(qreal inset)
void focusOutEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void placeholderTextChanged()
Qt::FocusReason focusReason
bool isHovered() const
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setRightInset(qreal inset)
void setHoverEnabled(bool enabled)
virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
QColor placeholderTextColor
void setBackground(QQuickItem *background)
qreal implicitBackgroundWidth
void setLeftInset(qreal inset)
QQuickItem * background
void setHovered(bool hovered)
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void setBottomInset(qreal inset)
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setFocusReason(Qt::FocusReason reason)
void mouseMoveEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press 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 backgroundChanged()
void setPlaceholderText(const QString &text)
bool contains(const QPointF &point) const override
\qmlmethod bool QtQuick::Item::contains(point point)
qreal implicitBackgroundHeight
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
QQuickTextArea(QQuickItem *parent=nullptr)
void focusReasonChanged()
bool isHoverEnabled() const
void setPlaceholderTextColor(const QColor &color)
void setFont(const QFont &font)
void mouseReleaseEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
static QQuickTextAreaAttached * qmlAttachedProperties(QObject *object)
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void mouseDoubleClickEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
QQuickTextEdit::WrapMode wrapMode
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void mouseMoveEvent(QMouseEvent *event) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void componentComplete() override
Ensures any delayed caching or data loading the class needs to performed is complete.
void hoverLeaveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void contentSizeChanged()
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void mouseReleaseEvent(QMouseEvent *event) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void mouseDoubleClickEvent(QMouseEvent *event) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
void mousePressEvent(QMouseEvent *event) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void hoverEnterEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-enter 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 cursorRectangleChanged()
HAlignment effectiveHAlign() const
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\inmodule QtCore\reentrant
Definition qrect.h:484
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:500
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:672
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
Definition qrect.h:762
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition qrect.h:813
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:497
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:498
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:499
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
Definition qsgnode.cpp:1101
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
Definition qsgnode.cpp:398
QSGNode * parent() const
Returns the parent node of this node.
Definition qsgnode.h:93
QSGNode * firstChild() const
Returns the first child of this node.
Definition qsgnode.h:105
\inmodule QtCore
Definition qsize.h:208
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qcoreevent.h:366
QString text
Combined button and popup list for selecting options.
@ AllButtons
Definition qnamespace.h:90
FocusReason
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:349
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
GLuint color
[2]
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
GLboolean reset
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
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)
#define emit
#define Q_UNUSED(x)
static QString backgroundName()
double qreal
Definition qtypes.h:187
QGraphicsItem * item
\inmodule QtQuick
Definition qquickitem.h:159