239 :
public QObjectPrivate
240 ,
public QQuickPaletteProviderPrivateBase<QQuickItem, QQuickItemPrivate>
242 Q_DECLARE_PUBLIC(QQuickItem)
245 static QQuickItemPrivate* get(QQuickItem *item) {
return item->d_func(); }
246 static const QQuickItemPrivate* get(
const QQuickItem *item) {
return item->d_func(); }
249 ~QQuickItemPrivate() override;
250 void init(QQuickItem *parent);
252 QQmlListProperty<QObject> data();
253 QQmlListProperty<QObject> resources();
254 QQmlListProperty<QQuickItem> children();
255 QQmlListProperty<QQuickItem> visibleChildren();
257 QQmlListProperty<QQuickState> states();
258 QQmlListProperty<QQuickTransition> transitions();
260 QString state()
const;
261 void setState(
const QString &);
263 QQuickAnchorLine left()
const;
264 QQuickAnchorLine right()
const;
265 QQuickAnchorLine horizontalCenter()
const;
266 QQuickAnchorLine top()
const;
267 QQuickAnchorLine bottom()
const;
268 QQuickAnchorLine verticalCenter()
const;
269 QQuickAnchorLine baseline()
const;
271#if QT_CONFIG(quick_shadereffect)
272 QQuickItemLayer *layer()
const;
275 void localizedTouchEvent(
const QTouchEvent *event,
bool isFiltering, QMutableTouchEvent *localized);
276 bool hasPointerHandlers()
const;
277 bool hasEnabledHoverHandlers()
const;
278 virtual void addPointerHandler(QQuickPointerHandler *h);
279 virtual void removePointerHandler(QQuickPointerHandler *h);
281 QObject *setContextMenu(QObject *menu);
282 QObject *contextMenu()
const {
return extra.isAllocated() ? extra->contextMenu :
nullptr; }
284 virtual QtPrivate::QQuickAttachedPropertyPropagator *attachedPropertyPropagator_parent(
285 const QMetaObject *attachedType);
288 static void data_append(QQmlListProperty<QObject> *, QObject *);
289 static qsizetype data_count(QQmlListProperty<QObject> *);
290 static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
291 static void data_clear(QQmlListProperty<QObject> *);
292 static void data_removeLast(QQmlListProperty<QObject> *);
295 static QObject *resources_at(QQmlListProperty<QObject> *, qsizetype);
296 static void resources_append(QQmlListProperty<QObject> *, QObject *);
297 static qsizetype resources_count(QQmlListProperty<QObject> *);
298 static void resources_clear(QQmlListProperty<QObject> *);
299 static void resources_removeLast(QQmlListProperty<QObject> *);
302 static void children_append(QQmlListProperty<QQuickItem> *, QQuickItem *);
303 static qsizetype children_count(QQmlListProperty<QQuickItem> *);
304 static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, qsizetype);
305 static void children_clear(QQmlListProperty<QQuickItem> *);
306 static void children_removeLast(QQmlListProperty<QQuickItem> *);
309 static qsizetype visibleChildren_count(QQmlListProperty<QQuickItem> *prop);
310 static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index);
313 static qsizetype transform_count(QQmlListProperty<QQuickTransform> *list);
314 static void transform_append(QQmlListProperty<QQuickTransform> *list, QQuickTransform *);
315 static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, qsizetype);
316 static void transform_clear(QQmlListProperty<QQuickTransform> *list);
318 void _q_resourceObjectDeleted(QObject *);
319 quint64 _q_createJSWrapper(QQmlV4ExecutionEnginePtr engine);
330 ImplicitWidth = 0x100,
331 ImplicitHeight = 0x200,
336 AllChanges = 0xFFFFFFFF
339 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
340 friend inline QDebug &operator<<(QDebug &dbg, QQuickItemPrivate::ChangeTypes types) {
341#define CHANGETYPE_OUTPUT(Type) if (types & QQuickItemPrivate::Type) { dbg << first << #Type ; first = '|'; }
342 QDebugStateSaver state(dbg);
343 dbg.noquote().nospace();
344 if (types == QQuickItemPrivate::AllChanges) {
345 dbg <<
" AllChanges";
362#undef CHANGETYPE_OUTPUT
367 struct ChangeListener {
368 using ChangeTypes = QQuickItemPrivate::ChangeTypes;
370 ChangeListener(QQuickItemChangeListener *l =
nullptr, ChangeTypes t = { })
373 , gTypes(QQuickGeometryChange::All)
376 ChangeListener(QQuickItemChangeListener *l, QQuickGeometryChange gt)
382 bool operator==(
const ChangeListener &other)
const
383 {
return listener == other.listener && types == other.types; }
385 QQuickItemChangeListener *listener;
387 QQuickGeometryChange gTypes;
389#ifndef QT_NO_DEBUG_STREAM
391 friend QDebug operator<<(QDebug debug,
const QQuickItemPrivate::ChangeListener &listener);
396 template <
typename Fn,
typename ...Args>
397 void notifyChangeListeners(QQuickItemPrivate::ChangeTypes changeTypes, Fn &&function, Args &&...args)
400 if (changeListeners.isEmpty())
403 const auto listeners = changeListeners;
404 for (
const QQuickItemPrivate::ChangeListener &change : listeners) {
405 Q_ASSERT(change.listener);
406 if (change.types & changeTypes) {
407#ifdef QT_BUILD_INTERNAL
408 if (changeTypes == AllChanges && change.listener->anchorPrivate() ==
nullptr) {
411 }
else if (change.listener->baseDeleted(q)) {
412 auto output = qCritical();
414 output <<
"Listener already tagged as destroyed when called!"
415 <<
"\n\tListener:" << change.listener->debugName()
416 <<
"\n\tChanges:" << change.types
417 <<
"\n\tCaller: " << q
418 <<
"\n\tChanges:" << changeTypes;
421 if constexpr (std::is_member_function_pointer_v<Fn>)
422 (change.listener->*function)(args...);
424 function(change, args...);
426 if (changeTypes & QQuickItemPrivate::Destroyed)
427 change.listener->removeSourceItem(q);
432 Q_QUICK_EXPORT ExtraData();
438 qreal biggestPointerHandlerMarginCache;
440 QQuickContents *contents;
441 QQuickScreenAttached *screenAttached;
442 QQuickLayoutMirroringAttached* layoutDirectionAttached;
443 QQuickEnterKeyAttached *enterKeyAttached;
444 QQuickItemKeyFilter *keyHandler;
445 QList<QQuickPointerHandler *> pointerHandlers;
446 QObject *contextMenu;
447#if QT_CONFIG(quick_shadereffect)
448 mutable QQuickItemLayer *layer;
453 QPointF userTransformOriginPoint;
459 int recursiveEffectRefCount;
461 int maskContainsIndex;
464 QPointer<QObject> mask;
466 QSGOpacityNode *opacityNode;
467 QQuickDefaultClipNode *clipNode;
468 QSGRootNode *rootNode;
470 QQuickDeliveryAgent *subsceneDeliveryAgent =
nullptr;
472 QObjectList resourcesList;
478 Qt::MouseButtons acceptedMouseButtons;
479 Qt::MouseButtons acceptedMouseButtonsWithoutHandlers;
482 uint transparentForPositioner : 1;
484 uint mutabilityGroup : 4;
485 uint mutabilityGroupSet : 1;
492 LeftMouseButtonAccepted = 0x2
494 Q_DECLARE_FLAGS(ExtraDataTags, ExtraDataTag)
496 QLazilyAllocated<ExtraData, ExtraDataTags> extra;
498 virtual void registerAsContainmentMask(QQuickItem * ,
bool ) { }
500 QQuickAnchors *anchors()
const;
501 mutable QQuickAnchors *_anchors;
503 inline Qt::MouseButtons acceptedMouseButtons()
const;
505 QList<QQuickItemPrivate::ChangeListener> changeListeners;
507 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
508 void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
509 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
510 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
511 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
513 QQuickStateGroup *_states();
514 QQuickStateGroup *_stateGroup;
516 inline QQuickItem::TransformOrigin origin()
const;
520 quint32 widthValidFlag:1;
521 quint32 heightValidFlag:1;
522 quint32 componentComplete:1;
525 quint32 hoverEnabled:1;
527 quint32 antialiasing:1;
530 quint32 activeFocus:1;
531 quint32 notifiedFocus:1;
532 quint32 notifiedActiveFocus:1;
533 quint32 filtersChildMouseEvents:1;
534 quint32 explicitVisible:1;
535 quint32 effectiveVisible:1;
536 quint32 explicitEnable:1;
537 quint32 effectiveEnable:1;
538 quint32 polishScheduled:1;
539 quint32 inheritedLayoutMirror:1;
540 quint32 effectiveLayoutMirror:1;
541 quint32 isMirrorImplicit:1;
542 quint32 inheritMirrorFromParent:1;
543 quint32 inheritMirrorFromItem:1;
544 quint32 isAccessible:1;
548 quint32 subtreeCursorEnabled:1;
549 quint32 subtreeHoverEnabled:1;
550 quint32 activeFocusOnTab:1;
551 quint32 implicitAntialiasing:1;
552 quint32 antialiasingValid:1;
558 quint32 isTabFence:1;
559 quint32 replayingPressEvent:1;
561 quint32 touchEnabled:1;
562 quint32 hasCursorHandler:1;
564 quint32 maybeHasSubsceneDeliveryAgent:1;
567 quint32 subtreeTransformChangedEnabled:1;
568 quint32 inDestructor:1;
569 quint32 focusReason:4;
570 quint32 focusPolicy:4;
575 mutable quint32 eventHandlingChildrenWithinBounds:1;
576 mutable quint32 eventHandlingChildrenWithinBoundsSet:1;
578 quint32 customOverlay:1;
581 static bool customOverlayRequested;
582 void requestCustomOverlay();
585 TransformOrigin = 0x00000001,
586 Transform = 0x00000002,
587 BasicTransform = 0x00000004,
588 Position = 0x00000008,
592 Content = 0x00000040,
594 OpacityValue = 0x00000100,
595 ChildrenChanged = 0x00000200,
596 ChildrenStackingChanged = 0x00000400,
597 ParentChanged = 0x00000800,
602 EffectReference = 0x00008000,
603 Visible = 0x00010000,
604 HideReference = 0x00020000,
605 Antialiasing = 0x00040000,
609 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
611 ComplexTransformUpdateMask = Transform | Window,
612 ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing,
613 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
616 quint32 dirtyAttributes;
617 QString dirtyToString()
const;
618 void dirty(DirtyType);
619 void addToDirtyList();
620 void removeFromDirtyList();
621 QQuickItem *nextDirtyItem;
622 QQuickItem**prevDirtyItem;
624 void setCulled(
bool);
626 QQuickWindow *window;
627 QWindow *renderWindow(QPoint *offset =
nullptr)
const;
629 inline QSGContext *sceneGraphContext()
const;
630 inline QSGRenderContext *sceneGraphRenderContext()
const;
632 QQuickItem *parentItem;
634 QList<QQuickItem *> childItems;
635 mutable QList<QQuickItem *> *sortedChildItems;
636 QList<QQuickItem *> paintOrderChildItems()
const;
637 void addChild(QQuickItem *);
638 void removeChild(QQuickItem *);
639 void siblingOrderChanged();
641 inline void markSortedChildrenDirty(QQuickItem *child);
643 void refWindow(QQuickWindow *);
646 qreal effectiveDevicePixelRatio()
const;
648 QPointer<QQuickItem> subFocusItem;
649 void updateSubFocusItem(QQuickItem *scope,
bool focus);
651 bool setFocusIfNeeded(QEvent::Type);
652 Qt::FocusReason lastFocusChangeReason()
const;
653 virtual bool setLastFocusChangeReason(Qt::FocusReason reason);
655 QTransform windowToItemTransform()
const;
656 QTransform itemToWindowTransform()
const;
657 void itemToParentTransform(QTransform *)
const;
659 static bool focusNextPrev(QQuickItem *item,
bool forward);
660 static QQuickItem *nextTabChildItem(
const QQuickItem *item,
int start);
661 static QQuickItem *prevTabChildItem(
const QQuickItem *item,
int start);
662 static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item,
bool forward,
bool wrap =
true);
664 static bool canAcceptTabFocus(QQuickItem *item);
666 void setX(qreal x) {q_func()->setX(x);}
667 void xChanged() { Q_EMIT q_func()->xChanged(); }
668 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, x, &QQuickItemPrivate::setX, &QQuickItemPrivate::xChanged);
669 void setY(qreal y) {q_func()->setY(y);}
670 void yChanged() { Q_EMIT q_func()->yChanged(); }
671 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, y, &QQuickItemPrivate::setY, &QQuickItemPrivate::yChanged);
672 void setWidth(qreal width) {q_func()->setWidth(width);}
673 void widthChanged() { Q_EMIT q_func()->widthChanged(); }
674 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, width, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged);
675 void setHeight(qreal height) {q_func()->setHeight(height);}
676 void heightChanged() { Q_EMIT q_func()->heightChanged(); }
677 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, height, &QQuickItemPrivate::setHeight, &QQuickItemPrivate::heightChanged);
679 qreal implicitHeight;
681 bool widthValid()
const {
return widthValidFlag || (width.hasBinding() && !QQmlPropertyBinding::isUndefined(width.binding()) ); }
682 bool heightValid()
const {
return heightValidFlag || (height.hasBinding() && !QQmlPropertyBinding::isUndefined(height.binding()) ); }
684 qreal baselineOffset;
686 QList<QQuickTransform *> transforms;
688 inline qreal z()
const {
return extra.isAllocated()?extra->z:0; }
689 inline qreal scale()
const {
return extra.isAllocated()?extra->scale:1; }
690 inline qreal rotation()
const {
return extra.isAllocated()?extra->rotation:0; }
691 inline qreal opacity()
const {
return extra.isAllocated()?extra->opacity:1; }
693 void setAccessible();
695 virtual qreal getImplicitWidth()
const;
696 virtual qreal getImplicitHeight()
const;
697 virtual void implicitWidthChanged();
698 virtual void implicitHeightChanged();
700#if QT_CONFIG(accessibility)
701 QAccessible::Role effectiveAccessibleRole()
const;
703 virtual QAccessible::Role accessibleRole()
const;
707 void setImplicitAntialiasing(
bool antialiasing);
709 void resolveLayoutMirror();
710 void setImplicitLayoutMirror(
bool mirror,
bool inherit);
711 void setLayoutMirror(
bool mirror);
712 bool isMirrored()
const {
713 return effectiveLayoutMirror;
716 void emitChildrenRectChanged(
const QRectF &rect) {
718 Q_EMIT q->childrenRectChanged(rect);
721 QPointF computeTransformOrigin()
const;
722 virtual bool transformChanged(QQuickItem *transformedItem);
724 QPointF adjustedPosForTransform(
const QPointF ¢roid,
725 const QPointF &startPos,
const QVector2D &activeTranslatation,
726 qreal startScale, qreal activeScale,
727 qreal startRotation, qreal activeRotation);
729 QQuickDeliveryAgent *deliveryAgent();
730 QQuickDeliveryAgentPrivate *deliveryAgentPrivate();
731 QQuickDeliveryAgent *ensureSubsceneDeliveryAgent();
733 void deliverKeyEvent(QKeyEvent *);
734 bool filterKeyEvent(QKeyEvent *,
bool post);
736 void deliverInputMethodEvent(QInputMethodEvent *);
738 void deliverShortcutOverrideEvent(QKeyEvent *);
740 void deliverPointerEvent(QEvent *);
742 bool anyPointerHandlerWants(
const QPointerEvent *event,
const QEventPoint &point)
const;
743 virtual bool handlePointerEvent(QPointerEvent *,
bool avoidGrabbers =
false);
744#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
745 virtual bool handleContextMenuEvent(QContextMenuEvent *event);
748 virtual void setVisible(
bool visible);
750 bool isTransparentForPositioner()
const;
751 void setTransparentForPositioner(
bool trans);
753 bool calcEffectiveVisible()
const;
754 bool setEffectiveVisibleRecur(
bool);
755 bool calcEffectiveEnable()
const;
756 void setEffectiveEnableRecur(QQuickItem *scope,
bool);
758 qreal biggestPointerHandlerMargin()
const;
759 QRectF eventHandlingBounds(qreal margin = 0)
const;
760 bool parentFullyContains()
const;
761 bool effectivelyClipsEventHandlingChildren()
const;
763 inline QSGTransformNode *itemNode();
764 inline QSGNode *childContainerNode();
767
768
769
770
771
772
774 QSGOpacityNode *opacityNode()
const {
return extra.isAllocated()?extra->opacityNode:
nullptr; }
775 QQuickDefaultClipNode *clipNode()
const {
return extra.isAllocated()?extra->clipNode:
nullptr; }
776 QSGRootNode *rootNode()
const {
return extra.isAllocated()?extra->rootNode:
nullptr; }
778 QSGTransformNode *itemNodeInstance;
781 virtual QSGTransformNode *createTransformNode();
785 void refFromEffectItem(
bool hide);
786 void recursiveRefFromEffectItem(
int refs);
787 void derefFromEffectItem(
bool unhide);
789 void itemChange(QQuickItem::ItemChange,
const QQuickItem::ItemChangeData &);
791 void enableSubtreeChangeNotificationsForParentHierachy();
793 virtual void mirrorChange() {}
795 void setHasCursorInChild(
bool hasCursor);
796 void setHasHoverInChild(
bool hasHover);
798 QCursor effectiveCursor(
const QQuickPointerHandler *handler)
const;
799 QQuickPointerHandler *effectiveCursorHandler()
const;
802 virtual void updatePolish() { }
803 virtual void dumpItemTree(
int indent)
const;
805 QLayoutPolicy sizePolicy()
const;
806 void setSizePolicy(
const QLayoutPolicy::Policy &horizontalPolicy,
const QLayoutPolicy::Policy &verticalPolicy);
807 QLayoutPolicy szPolicy;
809#ifdef QT_BUILD_INTERNAL
810 static quint32 item_counter;
811 static quint32 itemExtra_counter;
812 static quint32 eventHandlingChildrenWithinBounds_counter;
813 static quint64 itemToParentTransform_counter;
814 static quint64 itemToWindowTransform_counter;
815 static quint64 windowToItemTransform_counter;
816 static quint64 effectiveClippingSkips_counter;
1006 Q_DECLARE_PRIVATE(QQuickKeysAttached)
1008 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
1009 Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo FINAL)
1010 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
1012 QML_NAMED_ELEMENT(Keys)
1013 QML_ADDED_IN_VERSION(2, 0)
1014 QML_UNCREATABLE(
"Keys is only available via attached properties")
1015 QML_ATTACHED(QQuickKeysAttached)
1018 QQuickKeysAttached(QObject *parent=
nullptr);
1019 ~QQuickKeysAttached() override;
1021 bool enabled()
const { Q_D(
const QQuickKeysAttached);
return d->enabled; }
1022 void setEnabled(
bool enabled) {
1023 Q_D(QQuickKeysAttached);
1024 if (enabled != d->enabled) {
1025 d->enabled = enabled;
1026 Q_EMIT enabledChanged();
1030 enum Priority { BeforeItem, AfterItem};
1032 Priority priority()
const;
1033 void setPriority(Priority);
1035 QQmlListProperty<QQuickItem> forwardTo() {
1036 Q_D(QQuickKeysAttached);
1037 return QQmlListProperty<QQuickItem>(
this, &(d->targets));
1040 void componentComplete() override;
1042 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
1045 void enabledChanged();
1046 void priorityChanged();
1047 void pressed(QQuickKeyEvent *event);
1048 void released(QQuickKeyEvent *event);
1049 void shortcutOverride(QQuickKeyEvent *event);
1050 void digit0Pressed(QQuickKeyEvent *event);
1051 void digit1Pressed(QQuickKeyEvent *event);
1052 void digit2Pressed(QQuickKeyEvent *event);
1053 void digit3Pressed(QQuickKeyEvent *event);
1054 void digit4Pressed(QQuickKeyEvent *event);
1055 void digit5Pressed(QQuickKeyEvent *event);
1056 void digit6Pressed(QQuickKeyEvent *event);
1057 void digit7Pressed(QQuickKeyEvent *event);
1058 void digit8Pressed(QQuickKeyEvent *event);
1059 void digit9Pressed(QQuickKeyEvent *event);
1061 void leftPressed(QQuickKeyEvent *event);
1062 void rightPressed(QQuickKeyEvent *event);
1063 void upPressed(QQuickKeyEvent *event);
1064 void downPressed(QQuickKeyEvent *event);
1065 void tabPressed(QQuickKeyEvent *event);
1066 void backtabPressed(QQuickKeyEvent *event);
1068 void asteriskPressed(QQuickKeyEvent *event);
1069 void numberSignPressed(QQuickKeyEvent *event);
1070 void escapePressed(QQuickKeyEvent *event);
1071 void returnPressed(QQuickKeyEvent *event);
1072 void enterPressed(QQuickKeyEvent *event);
1073 void deletePressed(QQuickKeyEvent *event);
1074 void spacePressed(QQuickKeyEvent *event);
1075 void backPressed(QQuickKeyEvent *event);
1076 void cancelPressed(QQuickKeyEvent *event);
1077 void selectPressed(QQuickKeyEvent *event);
1078 void yesPressed(QQuickKeyEvent *event);
1079 void noPressed(QQuickKeyEvent *event);
1080 void context1Pressed(QQuickKeyEvent *event);
1081 void context2Pressed(QQuickKeyEvent *event);
1082 void context3Pressed(QQuickKeyEvent *event);
1083 void context4Pressed(QQuickKeyEvent *event);
1084 void callPressed(QQuickKeyEvent *event);
1085 void hangupPressed(QQuickKeyEvent *event);
1086 void flipPressed(QQuickKeyEvent *event);
1087 void menuPressed(QQuickKeyEvent *event);
1088 void volumeUpPressed(QQuickKeyEvent *event);
1089 void volumeDownPressed(QQuickKeyEvent *event);
1092 void keyPressed(QKeyEvent *event,
bool post) override;
1093 void keyReleased(QKeyEvent *event,
bool post) override;
1095 void inputMethodEvent(QInputMethodEvent *,
bool post) override;
1096 QVariant inputMethodQuery(Qt::InputMethodQuery query)
const override;
1098 void shortcutOverrideEvent(QKeyEvent *event) override;
1099 static QByteArray keyToSignal(
int key);
1101 bool isConnected(
const char *signalName)
const;