Qt 6.x
The Qt SDK
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
123{
124#if QT_CONFIG(accessibility)
125 QAccessible::installActivationObserver(this);
126#endif
127}
128
130{
131#if QT_CONFIG(accessibility)
132 QAccessible::removeActivationObserver(this);
133#endif
134}
135
137{
138 Q_Q(QQuickTextArea);
139 const QMarginsF oldInset = getInset();
140 extra.value().topInset = value;
141 extra.value().hasTopInset = !reset;
142 if (!qFuzzyCompare(oldInset.top(), value)) {
143 emit q->topInsetChanged();
144 q->insetChange(getInset(), oldInset);
145 }
146}
147
149{
150 Q_Q(QQuickTextArea);
151 const QMarginsF oldInset = getInset();
152 extra.value().leftInset = value;
153 extra.value().hasLeftInset = !reset;
154 if (!qFuzzyCompare(oldInset.left(), value)) {
155 emit q->leftInsetChanged();
156 q->insetChange(getInset(), oldInset);
157 }
158}
159
161{
162 Q_Q(QQuickTextArea);
163 const QMarginsF oldInset = getInset();
164 extra.value().rightInset = value;
165 extra.value().hasRightInset = !reset;
166 if (!qFuzzyCompare(oldInset.right(), value)) {
167 emit q->rightInsetChanged();
168 q->insetChange(getInset(), oldInset);
169 }
170}
171
173{
174 Q_Q(QQuickTextArea);
175 const QMarginsF oldInset = getInset();
176 extra.value().bottomInset = value;
177 extra.value().hasBottomInset = !reset;
178 if (!qFuzzyCompare(oldInset.bottom(), value)) {
179 emit q->bottomInsetChanged();
180 q->insetChange(getInset(), oldInset);
181 }
182}
183
185{
186 if (!background)
187 return;
188
189 resizingBackground = true;
190
191 // When using the attached property TextArea.flickable, we reparent the background out
192 // of TextArea and into the Flickable since we don't want the background to move while
193 // flicking. This means that the size of the background should also follow the size of
194 // the Flickable rather than the size of the TextArea.
195 const auto flickable = qobject_cast<QQuickFlickable *>(background->parentItem());
196
198 if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
199 || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
200 const qreal bgWidth = flickable ? flickable->width() : width;
203 }
204
205 if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
206 || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
207 const qreal bgHeight = flickable ? flickable->height() : height;
210 }
211
212 resizingBackground = false;
213}
214
224{
225 Q_Q(QQuickTextArea);
227}
228
230{
231 QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
232 parentFont.setResolveMask(extra.isAllocated() ? extra->requestedFont.resolveMask() | font.resolveMask() : font.resolveMask());
233
234 const QFont defaultFont = QQuickTheme::font(QQuickTheme::TextArea);
235 QFont resolvedFont = parentFont.resolve(defaultFont);
236
237 setFont_helper(resolvedFont);
238}
239
246{
247 Q_Q(QQuickTextArea);
248 QFont oldFont = sourceFont;
249 q->QQuickTextEdit::setFont(font);
250
252
253 if (oldFont != font)
254 emit q->fontChanged();
255}
256
257#if QT_CONFIG(quicktemplates2_hover)
258void QQuickTextAreaPrivate::updateHoverEnabled(bool enabled, bool xplicit)
259{
260 Q_Q(QQuickTextArea);
261 if (!xplicit && explicitHoverEnabled)
262 return;
263
264 bool wasEnabled = q->isHoverEnabled();
265 explicitHoverEnabled = xplicit;
266 if (wasEnabled != enabled) {
267 q->setAcceptHoverEvents(enabled);
268 QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
269 emit q->hoverEnabledChanged();
270 }
271}
272#endif
273
275{
276 Q_Q(QQuickTextArea);
277 flickable = item;
279
280 if (background)
282
285
288
293
295}
296
298{
299 Q_Q(QQuickTextArea);
300 q->setParentItem(nullptr);
303
306
309
314
315 flickable = nullptr;
316
318}
319
321{
322 Q_Q(QQuickTextArea);
323 if (!flickable)
324 return;
325
326 const qreal cx = flickable->contentX();
327 const qreal cy = flickable->contentY();
328 const qreal w = flickable->width();
329 const qreal h = flickable->height();
330
331 const qreal tp = q->topPadding();
332 const qreal lp = q->leftPadding();
333 const QRectF cr = q->cursorRectangle();
334
335 if (cr.left() <= cx + lp) {
336 flickable->setContentX(cr.left() - lp);
337 } else {
338 // calculate the rectangle of the next character and ensure that
339 // it's visible if it's on the same line with the cursor
340 const qreal rp = q->rightPadding();
341 const QRectF nr = q->cursorPosition() < q->length() ? q->positionToRectangle(q->cursorPosition() + 1) : QRectF();
342 if (qFuzzyCompare(nr.y(), cr.y()) && nr.right() >= cx + lp + w - rp)
343 flickable->setContentX(nr.right() - w + rp);
344 else if (cr.right() >= cx + lp + w - rp)
345 flickable->setContentX(cr.right() - w + rp);
346 }
347
348 if (cr.top() <= cy + tp) {
349 flickable->setContentY(cr.top() - tp);
350 } else {
351 const qreal bp = q->bottomPadding();
352 if (cr.bottom() >= cy + tp + h - bp && cr.bottom() <= flickable->contentHeight())
353 flickable->setContentY(cr.bottom() - h + bp);
354 }
355}
356
358{
359 Q_Q(QQuickTextArea);
360 if (!flickable)
361 return;
362
365 q->setSize(QSizeF(w, h));
366
368}
369
371{
372 Q_Q(QQuickTextArea);
373 if (!flickable)
374 return;
375
376 flickable->setContentWidth(q->implicitWidth());
377 flickable->setContentHeight(q->implicitHeight());
378}
379
381{
382 Q_UNUSED(diff);
385 // Only set hasBackgroundWidth/Height if it was a width/height change,
386 // otherwise we're prevented from setting a width/height in the future.
387 if (change.widthChange())
388 extra.value().hasBackgroundWidth = p->widthValid();
389 if (change.heightChange())
390 extra.value().hasBackgroundHeight = p->heightValid();
391 }
392
393 if (flickable)
395 else
397}
398
400{
402}
403
405{
407}
408
410{
411 Q_Q(QQuickTextArea);
413 emit q->implicitWidthChanged3();
414}
415
417{
418 Q_Q(QQuickTextArea);
420 emit q->implicitHeightChanged3();
421}
422
424{
425 Q_UNUSED(isReadOnly);
426#if QT_CONFIG(accessibility)
427 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q_func()))
428 accessibleAttached->set_readOnly(isReadOnly);
429#endif
430}
431
432#if QT_CONFIG(accessibility)
433void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active)
434{
435 if (!active)
436 return;
437
438 Q_Q(QQuickTextArea);
439 QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
440 Q_ASSERT(accessibleAttached);
441 accessibleAttached->setRole(effectiveAccessibleRole());
442 accessibleAttached->set_readOnly(q->isReadOnly());
443 accessibleAttached->setDescription(placeholder);
444}
445
446QAccessible::Role QQuickTextAreaPrivate::accessibleRole() const
447{
448 return QAccessible::EditableText;
449}
450#endif
451
453{
454 Q_Q(QQuickTextArea);
456}
457
459{
460 Q_Q(QQuickTextArea);
462 return;
463
464 if (!background || complete)
466 if (complete)
468}
469
471{
472 Q_Q(QQuickTextArea);
473 if (item == background)
474 emit q->implicitBackgroundWidthChanged();
475}
476
478{
479 Q_Q(QQuickTextArea);
480 if (item == background)
481 emit q->implicitBackgroundHeightChanged();
482}
483
485{
486 Q_Q(QQuickTextArea);
487 if (item == background) {
488 background = nullptr;
489 emit q->implicitBackgroundWidthChanged();
490 emit q->implicitBackgroundHeightChanged();
491 } else if (item == flickable) {
493 }
494}
495
497{
499}
500
503{
504 Q_D(QQuickTextArea);
507 d->setImplicitResizeEnabled(false);
508 d->pressHandler.control = this;
509
512#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
513 if (qEnvironmentVariable("QT_QUICK_CONTROLS_TEXT_SELECTION_BEHAVIOR") == u"old"_s)
514 QQuickTextEdit::setOldSelectionDefault();
515#endif
516}
517
519{
520 Q_D(QQuickTextArea);
521 if (d->flickable)
522 d->detachFlickable();
524}
525
527{
528 return new QQuickTextAreaAttached(object);
529}
530
532{
533 Q_D(const QQuickTextArea);
535 // The resolve mask should inherit from the requestedFont
536 font.setResolveMask(d->extra.value().requestedFont.resolveMask());
537 return font;
538}
539
541{
542 Q_D(QQuickTextArea);
543 if (d->extra.value().requestedFont.resolveMask() == font.resolveMask() && d->extra.value().requestedFont == font)
544 return;
545
546 d->extra.value().requestedFont = font;
547 d->resolveFont();
548}
549
560{
561 QQuickTextAreaPrivate *d = const_cast<QQuickTextAreaPrivate *>(d_func());
562 if (!d->background)
563 d->executeBackground();
564 return d->background;
565}
566
568{
569 Q_D(QQuickTextArea);
570 if (d->background == background)
571 return;
572
574
575 if (!d->background.isExecuting())
576 d->cancelBackground();
577
578 const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
579 const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
580
581 if (d->extra.isAllocated()) {
582 d->extra.value().hasBackgroundWidth = false;
583 d->extra.value().hasBackgroundHeight = false;
584 }
585
588 d->background = background;
589
590 if (background) {
592 if (p->widthValid() || p->heightValid()) {
593 d->extra.value().hasBackgroundWidth = p->widthValid();
594 d->extra.value().hasBackgroundHeight = p->heightValid();
595 }
596 if (d->flickable)
597 background->setParentItem(d->flickable);
598 else
600 if (qFuzzyIsNull(background->z()))
601 background->setZ(-1);
603 d->resizeBackground();
605 }
606
607 if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
608 emit implicitBackgroundWidthChanged();
609 if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
610 emit implicitBackgroundHeightChanged();
611 if (!d->background.isExecuting())
613}
614
622{
623 Q_D(const QQuickTextArea);
624 return d->placeholder;
625}
626
628{
629 Q_D(QQuickTextArea);
630 if (d->placeholder == text)
631 return;
632
633 d->placeholder = text;
634#if QT_CONFIG(accessibility)
635 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
636 accessibleAttached->setDescription(text);
637#endif
639}
640
650{
651 Q_D(const QQuickTextArea);
652 return d->placeholderColor;
653}
654
656{
657 Q_D(QQuickTextArea);
658 if (d->placeholderColor == color)
659 return;
660
661 d->placeholderColor = color;
662 emit placeholderTextColorChanged();
663}
664
671{
672 Q_D(const QQuickTextArea);
673 return d->focusReason;
674}
675
677{
678 Q_D(QQuickTextArea);
679 if (d->focusReason == reason)
680 return;
681
682 d->focusReason = reason;
684}
685
686bool QQuickTextArea::contains(const QPointF &point) const
687{
688 Q_D(const QQuickTextArea);
689 if (d->flickable && !d->flickable->contains(d->flickable->mapFromItem(this, point)))
690 return false;
691 return QQuickTextEdit::contains(point);
692}
693
704{
705#if QT_CONFIG(quicktemplates2_hover)
706 Q_D(const QQuickTextArea);
707 return d->hovered;
708#else
709 return false;
710#endif
711}
712
714{
715#if QT_CONFIG(quicktemplates2_hover)
716 Q_D(QQuickTextArea);
717 if (hovered == d->hovered)
718 return;
719
720 d->hovered = hovered;
721 emit hoveredChanged();
722#else
724#endif
725}
726
736{
737#if QT_CONFIG(quicktemplates2_hover)
738 Q_D(const QQuickTextArea);
739 return d->hoverEnabled;
740#else
741 return false;
742#endif
743}
744
746{
747#if QT_CONFIG(quicktemplates2_hover)
748 Q_D(QQuickTextArea);
749 if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
750 return;
751
752 d->updateHoverEnabled(enabled, true); // explicit=true
753#else
755#endif
756}
757
759{
760#if QT_CONFIG(quicktemplates2_hover)
761 Q_D(QQuickTextArea);
762 if (!d->explicitHoverEnabled)
763 return;
764
765 d->explicitHoverEnabled = false;
766 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
767#endif
768}
769
782{
783 Q_D(const QQuickTextArea);
784 if (!d->background)
785 return 0;
786 return d->background->implicitWidth();
787}
788
801{
802 Q_D(const QQuickTextArea);
803 if (!d->background)
804 return 0;
805 return d->background->implicitHeight();
806}
807
817{
818 Q_D(const QQuickTextArea);
819 return d->getTopInset();
820}
821
823{
824 Q_D(QQuickTextArea);
825 d->setTopInset(inset);
826}
827
829{
830 Q_D(QQuickTextArea);
831 d->setTopInset(0, true);
832}
833
843{
844 Q_D(const QQuickTextArea);
845 return d->getLeftInset();
846}
847
849{
850 Q_D(QQuickTextArea);
851 d->setLeftInset(inset);
852}
853
855{
856 Q_D(QQuickTextArea);
857 d->setLeftInset(0, true);
858}
859
869{
870 Q_D(const QQuickTextArea);
871 return d->getRightInset();
872}
873
875{
876 Q_D(QQuickTextArea);
877 d->setRightInset(inset);
878}
879
881{
882 Q_D(QQuickTextArea);
883 d->setRightInset(0, true);
884}
885
895{
896 Q_D(const QQuickTextArea);
897 return d->getBottomInset();
898}
899
901{
902 Q_D(QQuickTextArea);
903 d->setBottomInset(inset);
904}
905
907{
908 Q_D(QQuickTextArea);
909 d->setBottomInset(0, true);
910}
911
913{
914 Q_D(QQuickTextArea);
916 d->resolveFont();
917}
918
920{
921 Q_D(QQuickTextArea);
922 d->executeBackground(true);
924 d->resizeBackground();
925#if QT_CONFIG(quicktemplates2_hover)
926 if (!d->explicitHoverEnabled)
927 setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
928#endif
929#if QT_CONFIG(accessibility)
930 if (QAccessible::isActive())
931 d->accessibilityActiveChanged(true);
932#endif
933}
934
936{
937 Q_D(QQuickTextArea);
939 switch (change) {
941 break;
942 case ItemSceneChange:
944 if ((change == ItemParentHasChanged && value.item) || (change == ItemSceneChange && value.window)) {
945 d->resolveFont();
946#if QT_CONFIG(quicktemplates2_hover)
947 if (!d->explicitHoverEnabled)
948 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
949#endif
950 if (change == ItemParentHasChanged) {
951 QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(value.item->parentItem());
952 if (flickable) {
953 QQuickScrollView *scrollView = qobject_cast<QQuickScrollView *>(flickable->parentItem());
954 if (scrollView)
955 d->attachFlickable(flickable);
956 }
957 }
958 }
959 break;
960 default:
961 break;
962 }
963}
964
965void QQuickTextArea::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
966{
967 Q_D(QQuickTextArea);
968 QQuickTextEdit::geometryChange(newGeometry, oldGeometry);
969 d->resizeBackground();
970}
971
972void QQuickTextArea::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
973{
974 Q_D(QQuickTextArea);
975 Q_UNUSED(newInset);
976 Q_UNUSED(oldInset);
977 d->resizeBackground();
978}
979
981{
982 Q_D(QQuickTextArea);
983 QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
984 if (!clipNode)
985 clipNode = new QQuickDefaultClipNode(QRectF());
986
987 QQuickItem *clipper = this;
988 if (d->flickable)
989 clipper = d->flickable;
990
991 const QRectF cr = clipper->clipRect().adjusted(
993 (!d->cursorItem && effectiveHAlign() == HAlignment::AlignRight ? 1 : 0) - rightPadding(),
994 -bottomPadding());
995
996 clipNode->setRect(!d->flickable ? cr : cr.translated(d->flickable->contentX(), d->flickable->contentY()));
997 clipNode->update();
998
999 QSGNode *textNode = QQuickTextEdit::updatePaintNode(clipNode->firstChild(), data);
1000 if (!textNode->parent())
1001 clipNode->appendChildNode(textNode);
1002
1003 if (d->cursorItem) {
1004 QQuickDefaultClipNode *cursorNode = QQuickItemPrivate::get(d->cursorItem)->clipNode();
1005 if (cursorNode)
1006 cursorNode->setClipRect(d->cursorItem->mapRectFromItem(clipper, cr));
1007 }
1008
1009 return clipNode;
1010}
1011
1013{
1015 setFocusReason(event->reason());
1016}
1017
1019{
1021 setFocusReason(event->reason());
1022}
1023
1024#if QT_CONFIG(quicktemplates2_hover)
1026{
1027 Q_D(QQuickTextArea);
1029 setHovered(d->hoverEnabled);
1030 event->ignore();
1031}
1032
1034{
1036 setHovered(false);
1037 event->ignore();
1038}
1039#endif
1040
1042{
1043 Q_D(QQuickTextArea);
1044 d->pressHandler.mousePressEvent(event);
1045 if (d->pressHandler.isActive()) {
1046 if (d->pressHandler.delayedMousePressEvent) {
1047 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1048 d->pressHandler.clearDelayedMouseEvent();
1049 }
1050 // Calling the base class implementation will result in QQuickTextControl's
1051 // press handler being called, which ignores events that aren't Qt::LeftButton.
1052 const bool wasAccepted = event->isAccepted();
1054 if (wasAccepted)
1055 event->accept();
1056 }
1057}
1058
1060{
1061 Q_D(QQuickTextArea);
1062 d->pressHandler.mouseMoveEvent(event);
1063 if (d->pressHandler.isActive()) {
1064 if (d->pressHandler.delayedMousePressEvent) {
1065 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1066 d->pressHandler.clearDelayedMouseEvent();
1067 }
1069 }
1070}
1071
1073{
1074 Q_D(QQuickTextArea);
1075 d->pressHandler.mouseReleaseEvent(event);
1076 if (d->pressHandler.isActive()) {
1077 if (d->pressHandler.delayedMousePressEvent) {
1078 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1079 d->pressHandler.clearDelayedMouseEvent();
1080 }
1082 }
1083}
1084
1086{
1087 Q_D(QQuickTextArea);
1088 if (d->pressHandler.delayedMousePressEvent) {
1089 QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent.get());
1090 d->pressHandler.clearDelayedMouseEvent();
1091 }
1093}
1094
1096{
1097 Q_D(QQuickTextArea);
1098 if (event->timerId() == d->pressHandler.timer.timerId())
1099 d->pressHandler.timerEvent(event);
1100 else
1102}
1103
1105{
1106public:
1108};
1109
1112{
1113}
1114
1123{
1124 Q_D(const QQuickTextAreaAttached);
1125 return d->control;
1126}
1127
1129{
1131 QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(parent());
1132 if (!flickable) {
1133 qmlWarning(parent()) << "TextArea must be attached to a Flickable";
1134 return;
1135 }
1136
1137 if (d->control == control)
1138 return;
1139
1140 if (d->control)
1142
1143 d->control = control;
1144
1145 if (control)
1147
1149}
1150
1152
1153#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:469
\reentrant
Definition qfont.h:20
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:1854
void setResolveMask(uint mask)
Definition qfont.h:252
uint resolveMask() const
Definition qfont.h:251
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
\inmodule QtGui
Definition qevent.h:245
\inmodule QtCore
Definition qmargins.h:274
constexpr qreal right() const noexcept
Returns the right margin.
Definition qmargins.h:370
constexpr qreal left() const noexcept
Returns the left margin.
Definition qmargins.h:364
constexpr qreal top() const noexcept
Returns the top margin.
Definition qmargins.h:367
constexpr qreal bottom() const noexcept
Returns the bottom margin.
Definition qmargins.h:373
\inmodule QtGui
Definition qevent.h:195
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:298
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:327
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3099
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
Definition qobject.cpp:1433
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
\inmodule QtCore\reentrant
Definition qpoint.h:214
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)
void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types)
void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types)
QQuickDefaultClipNode * clipNode() const
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
virtual void implicitHeightChanged()
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
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:64
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:73
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
Definition qquickitem.h:75
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:74
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:76
QQuickItem * parentItem() const
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.
qreal height
This property holds the height of this item.
Definition qquickitem.h:77
void setZ(qreal)
void setWidth(qreal)
virtual QRectF clipRect() const
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:143
@ ItemEnabledHasChanged
Definition qquickitem.h:154
@ ItemParentHasChanged
Definition qquickitem.h:148
friend class QQuickAccessibleAttached
Definition qquickitem.h:474
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 readOnlyChanged(bool isReadOnly)
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.
FINALqreal leftPadding
void contentSizeChanged()
FINALqreal bottomPadding
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 readOnlyChanged(bool isReadOnly)
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.
FINALqreal topPadding
FINALqreal rightPadding
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:483
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:499
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:658
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:748
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:799
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:496
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:497
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:498
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
Definition qsgnode.cpp:1099
\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:396
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:207
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qcoreevent.h:359
QString text
Combined button and popup list for selecting options.
@ AllButtons
Definition qnamespace.h:89
FocusReason
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:287
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:303
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
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 Q_ASSERT(cond)
Definition qrandom.cpp:47
#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:92
QGraphicsItem * item
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
\inmodule QtQuick
Definition qquickitem.h:158