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);
283 virtual QtPrivate::QQuickAttachedPropertyPropagator *attachedPropertyPropagator_parent(
284 const QMetaObject *attachedType);
287 static void data_append(QQmlListProperty<QObject> *, QObject *);
288 static qsizetype data_count(QQmlListProperty<QObject> *);
289 static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
290 static void data_clear(QQmlListProperty<QObject> *);
291 static void data_removeLast(QQmlListProperty<QObject> *);
294 static QObject *resources_at(QQmlListProperty<QObject> *, qsizetype);
295 static void resources_append(QQmlListProperty<QObject> *, QObject *);
296 static qsizetype resources_count(QQmlListProperty<QObject> *);
297 static void resources_clear(QQmlListProperty<QObject> *);
298 static void resources_removeLast(QQmlListProperty<QObject> *);
301 static void children_append(QQmlListProperty<QQuickItem> *, QQuickItem *);
302 static qsizetype children_count(QQmlListProperty<QQuickItem> *);
303 static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, qsizetype);
304 static void children_clear(QQmlListProperty<QQuickItem> *);
305 static void children_removeLast(QQmlListProperty<QQuickItem> *);
308 static qsizetype visibleChildren_count(QQmlListProperty<QQuickItem> *prop);
309 static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index);
312 static qsizetype transform_count(QQmlListProperty<QQuickTransform> *list);
313 static void transform_append(QQmlListProperty<QQuickTransform> *list, QQuickTransform *);
314 static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, qsizetype);
315 static void transform_clear(QQmlListProperty<QQuickTransform> *list);
317 void _q_resourceObjectDeleted(QObject *);
318 quint64 _q_createJSWrapper(QQmlV4ExecutionEnginePtr engine);
329 ImplicitWidth = 0x100,
330 ImplicitHeight = 0x200,
335 AllChanges = 0xFFFFFFFF
338 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
339 friend inline QDebug &operator<<(QDebug &dbg, QQuickItemPrivate::ChangeTypes types) {
340#define CHANGETYPE_OUTPUT(Type) if (types & QQuickItemPrivate::Type) { dbg << first << #Type ; first = '|'; }
341 QDebugStateSaver state(dbg);
342 dbg.noquote().nospace();
343 if (types == QQuickItemPrivate::AllChanges) {
344 dbg <<
" AllChanges";
361#undef CHANGETYPE_OUTPUT
366 struct ChangeListener {
367 using ChangeTypes = QQuickItemPrivate::ChangeTypes;
369 ChangeListener(QQuickItemChangeListener *l =
nullptr, ChangeTypes t = { })
372 , gTypes(QQuickGeometryChange::All)
375 ChangeListener(QQuickItemChangeListener *l, QQuickGeometryChange gt)
381 bool operator==(
const ChangeListener &other)
const
382 {
return listener == other.listener && types == other.types; }
384 QQuickItemChangeListener *listener;
386 QQuickGeometryChange gTypes;
388#ifndef QT_NO_DEBUG_STREAM
390 friend QDebug operator<<(QDebug debug,
const QQuickItemPrivate::ChangeListener &listener);
395 template <
typename Fn,
typename ...Args>
396 void notifyChangeListeners(QQuickItemPrivate::ChangeTypes changeTypes, Fn &&function, Args &&...args)
399 if (changeListeners.isEmpty())
402 const auto listeners = changeListeners;
403 for (
const QQuickItemPrivate::ChangeListener &change : listeners) {
404 Q_ASSERT(change.listener);
405 if (change.types & changeTypes) {
406#ifdef QT_BUILD_INTERNAL
407 if (changeTypes == AllChanges && change.listener->anchorPrivate() ==
nullptr) {
410 }
else if (change.listener->baseDeleted(q)) {
411 auto output = qCritical();
413 output <<
"Listener already tagged as destroyed when called!"
414 <<
"\n\tListener:" << change.listener->debugName()
415 <<
"\n\tChanges:" << change.types
416 <<
"\n\tCaller: " << q
417 <<
"\n\tChanges:" << changeTypes;
420 if constexpr (std::is_member_function_pointer_v<Fn>)
421 (change.listener->*function)(args...);
423 function(change, args...);
425 if (changeTypes & QQuickItemPrivate::Destroyed)
426 change.listener->removeSourceItem(q);
431 Q_QUICK_EXPORT ExtraData();
437 qreal biggestPointerHandlerMarginCache;
439 QQuickContents *contents;
440 QQuickScreenAttached *screenAttached;
441 QQuickLayoutMirroringAttached* layoutDirectionAttached;
442 QQuickEnterKeyAttached *enterKeyAttached;
443 QQuickItemKeyFilter *keyHandler;
444 QList<QQuickPointerHandler *> pointerHandlers;
445 QObject *contextMenu;
446#if QT_CONFIG(quick_shadereffect)
447 mutable QQuickItemLayer *layer;
452 QPointF userTransformOriginPoint;
458 int recursiveEffectRefCount;
460 int maskContainsIndex;
463 QPointer<QObject> mask;
465 QSGOpacityNode *opacityNode;
466 QQuickDefaultClipNode *clipNode;
467 QSGRootNode *rootNode;
469 QQuickDeliveryAgent *subsceneDeliveryAgent =
nullptr;
471 QObjectList resourcesList;
477 Qt::MouseButtons acceptedMouseButtons;
478 Qt::MouseButtons acceptedMouseButtonsWithoutHandlers;
481 uint transparentForPositioner : 1;
483 uint mutabilityGroup : 4;
484 uint mutabilityGroupSet : 1;
491 LeftMouseButtonAccepted = 0x2
493 Q_DECLARE_FLAGS(ExtraDataTags, ExtraDataTag)
495 QLazilyAllocated<ExtraData, ExtraDataTags> extra;
497 virtual void registerAsContainmentMask(QQuickItem * ,
bool ) { }
499 QQuickAnchors *anchors()
const;
500 mutable QQuickAnchors *_anchors;
502 inline Qt::MouseButtons acceptedMouseButtons()
const;
504 QList<QQuickItemPrivate::ChangeListener> changeListeners;
506 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
507 void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
508 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
509 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
510 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
512 QQuickStateGroup *_states();
513 QQuickStateGroup *_stateGroup;
515 inline QQuickItem::TransformOrigin origin()
const;
519 quint32 widthValidFlag:1;
520 quint32 heightValidFlag:1;
521 quint32 componentComplete:1;
524 quint32 hoverEnabled:1;
526 quint32 antialiasing:1;
529 quint32 activeFocus:1;
530 quint32 notifiedFocus:1;
531 quint32 notifiedActiveFocus:1;
532 quint32 filtersChildMouseEvents:1;
533 quint32 explicitVisible:1;
534 quint32 effectiveVisible:1;
535 quint32 explicitEnable:1;
536 quint32 effectiveEnable:1;
537 quint32 polishScheduled:1;
538 quint32 inheritedLayoutMirror:1;
539 quint32 effectiveLayoutMirror:1;
540 quint32 isMirrorImplicit:1;
541 quint32 inheritMirrorFromParent:1;
542 quint32 inheritMirrorFromItem:1;
543 quint32 isAccessible:1;
547 quint32 subtreeCursorEnabled:1;
548 quint32 subtreeHoverEnabled:1;
549 quint32 activeFocusOnTab:1;
550 quint32 implicitAntialiasing:1;
551 quint32 antialiasingValid:1;
557 quint32 isTabFence:1;
558 quint32 replayingPressEvent:1;
560 quint32 touchEnabled:1;
561 quint32 hasCursorHandler:1;
563 quint32 maybeHasSubsceneDeliveryAgent:1;
566 quint32 subtreeTransformChangedEnabled:1;
567 quint32 inDestructor:1;
568 quint32 focusReason:4;
569 quint32 focusPolicy:4;
574 mutable quint32 eventHandlingChildrenWithinBounds:1;
575 mutable quint32 eventHandlingChildrenWithinBoundsSet:1;
577 quint32 customOverlay:1;
580 static bool customOverlayRequested;
581 void requestCustomOverlay();
584 TransformOrigin = 0x00000001,
585 Transform = 0x00000002,
586 BasicTransform = 0x00000004,
587 Position = 0x00000008,
591 Content = 0x00000040,
593 OpacityValue = 0x00000100,
594 ChildrenChanged = 0x00000200,
595 ChildrenStackingChanged = 0x00000400,
596 ParentChanged = 0x00000800,
601 EffectReference = 0x00008000,
602 Visible = 0x00010000,
603 HideReference = 0x00020000,
604 Antialiasing = 0x00040000,
608 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
610 ComplexTransformUpdateMask = Transform | Window,
611 ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing,
612 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
615 quint32 dirtyAttributes;
616 QString dirtyToString()
const;
617 void dirty(DirtyType);
618 void addToDirtyList();
619 void removeFromDirtyList();
620 QQuickItem *nextDirtyItem;
621 QQuickItem**prevDirtyItem;
623 void setCulled(
bool);
625 QQuickWindow *window;
627 inline QSGContext *sceneGraphContext()
const;
628 inline QSGRenderContext *sceneGraphRenderContext()
const;
630 QQuickItem *parentItem;
632 QList<QQuickItem *> childItems;
633 mutable QList<QQuickItem *> *sortedChildItems;
634 QList<QQuickItem *> paintOrderChildItems()
const;
635 void addChild(QQuickItem *);
636 void removeChild(QQuickItem *);
637 void siblingOrderChanged();
639 inline void markSortedChildrenDirty(QQuickItem *child);
641 void refWindow(QQuickWindow *);
644 qreal effectiveDevicePixelRatio()
const;
646 QPointer<QQuickItem> subFocusItem;
647 void updateSubFocusItem(QQuickItem *scope,
bool focus);
649 bool setFocusIfNeeded(QEvent::Type);
650 Qt::FocusReason lastFocusChangeReason()
const;
651 virtual bool setLastFocusChangeReason(Qt::FocusReason reason);
653 QTransform windowToItemTransform()
const;
654 QTransform itemToWindowTransform()
const;
655 void itemToParentTransform(QTransform *)
const;
657 static bool focusNextPrev(QQuickItem *item,
bool forward);
658 static QQuickItem *nextTabChildItem(
const QQuickItem *item,
int start);
659 static QQuickItem *prevTabChildItem(
const QQuickItem *item,
int start);
660 static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item,
bool forward,
bool wrap =
true);
662 static bool canAcceptTabFocus(QQuickItem *item);
664 void setX(qreal x) {q_func()->setX(x);}
665 void xChanged() { Q_EMIT q_func()->xChanged(); }
666 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, x, &QQuickItemPrivate::setX, &QQuickItemPrivate::xChanged);
667 void setY(qreal y) {q_func()->setY(y);}
668 void yChanged() { Q_EMIT q_func()->yChanged(); }
669 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, y, &QQuickItemPrivate::setY, &QQuickItemPrivate::yChanged);
670 void setWidth(qreal width) {q_func()->setWidth(width);}
671 void widthChanged() { Q_EMIT q_func()->widthChanged(); }
672 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, width, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged);
673 void setHeight(qreal height) {q_func()->setHeight(height);}
674 void heightChanged() { Q_EMIT q_func()->heightChanged(); }
675 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, height, &QQuickItemPrivate::setHeight, &QQuickItemPrivate::heightChanged);
677 qreal implicitHeight;
679 bool widthValid()
const {
return widthValidFlag || (width.hasBinding() && !QQmlPropertyBinding::isUndefined(width.binding()) ); }
680 bool heightValid()
const {
return heightValidFlag || (height.hasBinding() && !QQmlPropertyBinding::isUndefined(height.binding()) ); }
682 qreal baselineOffset;
684 QList<QQuickTransform *> transforms;
686 inline qreal z()
const {
return extra.isAllocated()?extra->z:0; }
687 inline qreal scale()
const {
return extra.isAllocated()?extra->scale:1; }
688 inline qreal rotation()
const {
return extra.isAllocated()?extra->rotation:0; }
689 inline qreal opacity()
const {
return extra.isAllocated()?extra->opacity:1; }
691 void setAccessible();
693 virtual qreal getImplicitWidth()
const;
694 virtual qreal getImplicitHeight()
const;
695 virtual void implicitWidthChanged();
696 virtual void implicitHeightChanged();
698#if QT_CONFIG(accessibility)
699 QAccessible::Role effectiveAccessibleRole()
const;
701 virtual QAccessible::Role accessibleRole()
const;
705 void setImplicitAntialiasing(
bool antialiasing);
707 void resolveLayoutMirror();
708 void setImplicitLayoutMirror(
bool mirror,
bool inherit);
709 void setLayoutMirror(
bool mirror);
710 bool isMirrored()
const {
711 return effectiveLayoutMirror;
714 void emitChildrenRectChanged(
const QRectF &rect) {
716 Q_EMIT q->childrenRectChanged(rect);
719 QPointF computeTransformOrigin()
const;
720 virtual bool transformChanged(QQuickItem *transformedItem);
722 QPointF adjustedPosForTransform(
const QPointF ¢roid,
723 const QPointF &startPos,
const QVector2D &activeTranslatation,
724 qreal startScale, qreal activeScale,
725 qreal startRotation, qreal activeRotation);
727 QQuickDeliveryAgent *deliveryAgent();
728 QQuickDeliveryAgentPrivate *deliveryAgentPrivate();
729 QQuickDeliveryAgent *ensureSubsceneDeliveryAgent();
731 void deliverKeyEvent(QKeyEvent *);
732 bool filterKeyEvent(QKeyEvent *,
bool post);
734 void deliverInputMethodEvent(QInputMethodEvent *);
736 void deliverShortcutOverrideEvent(QKeyEvent *);
738 void deliverPointerEvent(QEvent *);
740 bool anyPointerHandlerWants(
const QPointerEvent *event,
const QEventPoint &point)
const;
741 virtual bool handlePointerEvent(QPointerEvent *,
bool avoidGrabbers =
false);
742#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
743 virtual bool handleContextMenuEvent(QContextMenuEvent *event);
746 virtual void setVisible(
bool visible);
748 bool isTransparentForPositioner()
const;
749 void setTransparentForPositioner(
bool trans);
751 bool calcEffectiveVisible()
const;
752 bool setEffectiveVisibleRecur(
bool);
753 bool calcEffectiveEnable()
const;
754 void setEffectiveEnableRecur(QQuickItem *scope,
bool);
756 qreal biggestPointerHandlerMargin()
const;
757 QRectF eventHandlingBounds(qreal margin = 0)
const;
758 bool parentFullyContains()
const;
759 bool effectivelyClipsEventHandlingChildren()
const;
761 inline QSGTransformNode *itemNode();
762 inline QSGNode *childContainerNode();
765
766
767
768
769
770
772 QSGOpacityNode *opacityNode()
const {
return extra.isAllocated()?extra->opacityNode:
nullptr; }
773 QQuickDefaultClipNode *clipNode()
const {
return extra.isAllocated()?extra->clipNode:
nullptr; }
774 QSGRootNode *rootNode()
const {
return extra.isAllocated()?extra->rootNode:
nullptr; }
776 QSGTransformNode *itemNodeInstance;
779 virtual QSGTransformNode *createTransformNode();
783 void refFromEffectItem(
bool hide);
784 void recursiveRefFromEffectItem(
int refs);
785 void derefFromEffectItem(
bool unhide);
787 void itemChange(QQuickItem::ItemChange,
const QQuickItem::ItemChangeData &);
789 void enableSubtreeChangeNotificationsForParentHierachy();
791 virtual void mirrorChange() {}
793 void setHasCursorInChild(
bool hasCursor);
794 void setHasHoverInChild(
bool hasHover);
796 QCursor effectiveCursor(
const QQuickPointerHandler *handler)
const;
797 QQuickPointerHandler *effectiveCursorHandler()
const;
800 virtual void updatePolish() { }
801 virtual void dumpItemTree(
int indent)
const;
803 QLayoutPolicy sizePolicy()
const;
804 void setSizePolicy(
const QLayoutPolicy::Policy &horizontalPolicy,
const QLayoutPolicy::Policy &verticalPolicy);
805 QLayoutPolicy szPolicy;
807#ifdef QT_BUILD_INTERNAL
808 inline static quint32 item_counter = 0;
809 inline static quint32 itemExtra_counter = 0;
810 inline static quint32 eventHandlingChildrenWithinBounds_counter = 0;
811 inline static quint64 itemToParentTransform_counter = 0;
812 inline static quint64 itemToWindowTransform_counter = 0;
813 inline static quint64 windowToItemTransform_counter = 0;
814 inline static quint64 effectiveClippingSkips_counter = 0;
1004 Q_DECLARE_PRIVATE(QQuickKeysAttached)
1006 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
1007 Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo FINAL)
1008 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
1010 QML_NAMED_ELEMENT(Keys)
1011 QML_ADDED_IN_VERSION(2, 0)
1012 QML_UNCREATABLE(
"Keys is only available via attached properties")
1013 QML_ATTACHED(QQuickKeysAttached)
1016 QQuickKeysAttached(QObject *parent=
nullptr);
1017 ~QQuickKeysAttached() override;
1019 bool enabled()
const { Q_D(
const QQuickKeysAttached);
return d->enabled; }
1020 void setEnabled(
bool enabled) {
1021 Q_D(QQuickKeysAttached);
1022 if (enabled != d->enabled) {
1023 d->enabled = enabled;
1024 Q_EMIT enabledChanged();
1028 enum Priority { BeforeItem, AfterItem};
1030 Priority priority()
const;
1031 void setPriority(Priority);
1033 QQmlListProperty<QQuickItem> forwardTo() {
1034 Q_D(QQuickKeysAttached);
1035 return QQmlListProperty<QQuickItem>(
this, &(d->targets));
1038 void componentComplete() override;
1040 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
1043 void enabledChanged();
1044 void priorityChanged();
1045 void pressed(QQuickKeyEvent *event);
1046 void released(QQuickKeyEvent *event);
1047 void shortcutOverride(QQuickKeyEvent *event);
1048 void digit0Pressed(QQuickKeyEvent *event);
1049 void digit1Pressed(QQuickKeyEvent *event);
1050 void digit2Pressed(QQuickKeyEvent *event);
1051 void digit3Pressed(QQuickKeyEvent *event);
1052 void digit4Pressed(QQuickKeyEvent *event);
1053 void digit5Pressed(QQuickKeyEvent *event);
1054 void digit6Pressed(QQuickKeyEvent *event);
1055 void digit7Pressed(QQuickKeyEvent *event);
1056 void digit8Pressed(QQuickKeyEvent *event);
1057 void digit9Pressed(QQuickKeyEvent *event);
1059 void leftPressed(QQuickKeyEvent *event);
1060 void rightPressed(QQuickKeyEvent *event);
1061 void upPressed(QQuickKeyEvent *event);
1062 void downPressed(QQuickKeyEvent *event);
1063 void tabPressed(QQuickKeyEvent *event);
1064 void backtabPressed(QQuickKeyEvent *event);
1066 void asteriskPressed(QQuickKeyEvent *event);
1067 void numberSignPressed(QQuickKeyEvent *event);
1068 void escapePressed(QQuickKeyEvent *event);
1069 void returnPressed(QQuickKeyEvent *event);
1070 void enterPressed(QQuickKeyEvent *event);
1071 void deletePressed(QQuickKeyEvent *event);
1072 void spacePressed(QQuickKeyEvent *event);
1073 void backPressed(QQuickKeyEvent *event);
1074 void cancelPressed(QQuickKeyEvent *event);
1075 void selectPressed(QQuickKeyEvent *event);
1076 void yesPressed(QQuickKeyEvent *event);
1077 void noPressed(QQuickKeyEvent *event);
1078 void context1Pressed(QQuickKeyEvent *event);
1079 void context2Pressed(QQuickKeyEvent *event);
1080 void context3Pressed(QQuickKeyEvent *event);
1081 void context4Pressed(QQuickKeyEvent *event);
1082 void callPressed(QQuickKeyEvent *event);
1083 void hangupPressed(QQuickKeyEvent *event);
1084 void flipPressed(QQuickKeyEvent *event);
1085 void menuPressed(QQuickKeyEvent *event);
1086 void volumeUpPressed(QQuickKeyEvent *event);
1087 void volumeDownPressed(QQuickKeyEvent *event);
1090 void keyPressed(QKeyEvent *event,
bool post) override;
1091 void keyReleased(QKeyEvent *event,
bool post) override;
1093 void inputMethodEvent(QInputMethodEvent *,
bool post) override;
1094 QVariant inputMethodQuery(Qt::InputMethodQuery query)
const override;
1096 void shortcutOverrideEvent(QKeyEvent *event) override;
1097 static QByteArray keyToSignal(
int key);
1099 bool isConnected(
const char *signalName)
const;