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;
626 QWindow *renderWindow(QPoint *offset =
nullptr)
const;
628 inline QSGContext *sceneGraphContext()
const;
629 inline QSGRenderContext *sceneGraphRenderContext()
const;
631 QQuickItem *parentItem;
633 QList<QQuickItem *> childItems;
634 mutable QList<QQuickItem *> *sortedChildItems;
635 QList<QQuickItem *> paintOrderChildItems()
const;
636 void addChild(QQuickItem *);
637 void removeChild(QQuickItem *);
638 void siblingOrderChanged();
640 inline void markSortedChildrenDirty(QQuickItem *child);
642 void refWindow(QQuickWindow *);
645 qreal effectiveDevicePixelRatio()
const;
647 QPointer<QQuickItem> subFocusItem;
648 void updateSubFocusItem(QQuickItem *scope,
bool focus);
650 bool setFocusIfNeeded(QEvent::Type);
651 Qt::FocusReason lastFocusChangeReason()
const;
652 virtual bool setLastFocusChangeReason(Qt::FocusReason reason);
654 QTransform windowToItemTransform()
const;
655 QTransform itemToWindowTransform()
const;
656 void itemToParentTransform(QTransform *)
const;
658 static bool focusNextPrev(QQuickItem *item,
bool forward);
659 static QQuickItem *nextTabChildItem(
const QQuickItem *item,
int start);
660 static QQuickItem *prevTabChildItem(
const QQuickItem *item,
int start);
661 static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item,
bool forward,
bool wrap =
true);
663 static bool canAcceptTabFocus(QQuickItem *item);
665 void setX(qreal x) {q_func()->setX(x);}
666 void xChanged() { Q_EMIT q_func()->xChanged(); }
667 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, x, &QQuickItemPrivate::setX, &QQuickItemPrivate::xChanged);
668 void setY(qreal y) {q_func()->setY(y);}
669 void yChanged() { Q_EMIT q_func()->yChanged(); }
670 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, y, &QQuickItemPrivate::setY, &QQuickItemPrivate::yChanged);
671 void setWidth(qreal width) {q_func()->setWidth(width);}
672 void widthChanged() { Q_EMIT q_func()->widthChanged(); }
673 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, width, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged);
674 void setHeight(qreal height) {q_func()->setHeight(height);}
675 void heightChanged() { Q_EMIT q_func()->heightChanged(); }
676 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, height, &QQuickItemPrivate::setHeight, &QQuickItemPrivate::heightChanged);
678 qreal implicitHeight;
680 bool widthValid()
const {
return widthValidFlag || (width.hasBinding() && !QQmlPropertyBinding::isUndefined(width.binding()) ); }
681 bool heightValid()
const {
return heightValidFlag || (height.hasBinding() && !QQmlPropertyBinding::isUndefined(height.binding()) ); }
683 qreal baselineOffset;
685 QList<QQuickTransform *> transforms;
687 inline qreal z()
const {
return extra.isAllocated()?extra->z:0; }
688 inline qreal scale()
const {
return extra.isAllocated()?extra->scale:1; }
689 inline qreal rotation()
const {
return extra.isAllocated()?extra->rotation:0; }
690 inline qreal opacity()
const {
return extra.isAllocated()?extra->opacity:1; }
692 void setAccessible();
694 virtual qreal getImplicitWidth()
const;
695 virtual qreal getImplicitHeight()
const;
696 virtual void implicitWidthChanged();
697 virtual void implicitHeightChanged();
699#if QT_CONFIG(accessibility)
700 QAccessible::Role effectiveAccessibleRole()
const;
702 virtual QAccessible::Role accessibleRole()
const;
706 void setImplicitAntialiasing(
bool antialiasing);
708 void resolveLayoutMirror();
709 void setImplicitLayoutMirror(
bool mirror,
bool inherit);
710 void setLayoutMirror(
bool mirror);
711 bool isMirrored()
const {
712 return effectiveLayoutMirror;
715 void emitChildrenRectChanged(
const QRectF &rect) {
717 Q_EMIT q->childrenRectChanged(rect);
720 QPointF computeTransformOrigin()
const;
721 virtual bool transformChanged(QQuickItem *transformedItem);
723 QPointF adjustedPosForTransform(
const QPointF ¢roid,
724 const QPointF &startPos,
const QVector2D &activeTranslatation,
725 qreal startScale, qreal activeScale,
726 qreal startRotation, qreal activeRotation);
728 QQuickDeliveryAgent *deliveryAgent();
729 QQuickDeliveryAgentPrivate *deliveryAgentPrivate();
730 QQuickDeliveryAgent *ensureSubsceneDeliveryAgent();
732 void deliverKeyEvent(QKeyEvent *);
733 bool filterKeyEvent(QKeyEvent *,
bool post);
735 void deliverInputMethodEvent(QInputMethodEvent *);
737 void deliverShortcutOverrideEvent(QKeyEvent *);
739 void deliverPointerEvent(QEvent *);
741 bool anyPointerHandlerWants(
const QPointerEvent *event,
const QEventPoint &point)
const;
742 virtual bool handlePointerEvent(QPointerEvent *,
bool avoidGrabbers =
false);
743#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
744 virtual bool handleContextMenuEvent(QContextMenuEvent *event);
747 virtual void setVisible(
bool visible);
749 bool isTransparentForPositioner()
const;
750 void setTransparentForPositioner(
bool trans);
752 bool calcEffectiveVisible()
const;
753 bool setEffectiveVisibleRecur(
bool);
754 bool calcEffectiveEnable()
const;
755 void setEffectiveEnableRecur(QQuickItem *scope,
bool);
757 qreal biggestPointerHandlerMargin()
const;
758 QRectF eventHandlingBounds(qreal margin = 0)
const;
759 bool parentFullyContains()
const;
760 bool effectivelyClipsEventHandlingChildren()
const;
762 inline QSGTransformNode *itemNode();
763 inline QSGNode *childContainerNode();
766
767
768
769
770
771
773 QSGOpacityNode *opacityNode()
const {
return extra.isAllocated()?extra->opacityNode:
nullptr; }
774 QQuickDefaultClipNode *clipNode()
const {
return extra.isAllocated()?extra->clipNode:
nullptr; }
775 QSGRootNode *rootNode()
const {
return extra.isAllocated()?extra->rootNode:
nullptr; }
777 QSGTransformNode *itemNodeInstance;
780 virtual QSGTransformNode *createTransformNode();
784 void refFromEffectItem(
bool hide);
785 void recursiveRefFromEffectItem(
int refs);
786 void derefFromEffectItem(
bool unhide);
788 void itemChange(QQuickItem::ItemChange,
const QQuickItem::ItemChangeData &);
790 void enableSubtreeChangeNotificationsForParentHierachy();
792 virtual void mirrorChange() {}
794 void setHasCursorInChild(
bool hasCursor);
795 void setHasHoverInChild(
bool hasHover);
797 QCursor effectiveCursor(
const QQuickPointerHandler *handler)
const;
798 QQuickPointerHandler *effectiveCursorHandler()
const;
801 virtual void updatePolish() { }
802 virtual void dumpItemTree(
int indent)
const;
804 QLayoutPolicy sizePolicy()
const;
805 void setSizePolicy(
const QLayoutPolicy::Policy &horizontalPolicy,
const QLayoutPolicy::Policy &verticalPolicy);
806 QLayoutPolicy szPolicy;
808#ifdef QT_BUILD_INTERNAL
809 inline static quint32 item_counter = 0;
810 inline static quint32 itemExtra_counter = 0;
811 inline static quint32 eventHandlingChildrenWithinBounds_counter = 0;
812 inline static quint64 itemToParentTransform_counter = 0;
813 inline static quint64 itemToWindowTransform_counter = 0;
814 inline static quint64 windowToItemTransform_counter = 0;
815 inline static quint64 effectiveClippingSkips_counter = 0;
1005 Q_DECLARE_PRIVATE(QQuickKeysAttached)
1007 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
1008 Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo FINAL)
1009 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
1011 QML_NAMED_ELEMENT(Keys)
1012 QML_ADDED_IN_VERSION(2, 0)
1013 QML_UNCREATABLE(
"Keys is only available via attached properties")
1014 QML_ATTACHED(QQuickKeysAttached)
1017 QQuickKeysAttached(QObject *parent=
nullptr);
1018 ~QQuickKeysAttached() override;
1020 bool enabled()
const { Q_D(
const QQuickKeysAttached);
return d->enabled; }
1021 void setEnabled(
bool enabled) {
1022 Q_D(QQuickKeysAttached);
1023 if (enabled != d->enabled) {
1024 d->enabled = enabled;
1025 Q_EMIT enabledChanged();
1029 enum Priority { BeforeItem, AfterItem};
1031 Priority priority()
const;
1032 void setPriority(Priority);
1034 QQmlListProperty<QQuickItem> forwardTo() {
1035 Q_D(QQuickKeysAttached);
1036 return QQmlListProperty<QQuickItem>(
this, &(d->targets));
1039 void componentComplete() override;
1041 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
1044 void enabledChanged();
1045 void priorityChanged();
1046 void pressed(QQuickKeyEvent *event);
1047 void released(QQuickKeyEvent *event);
1048 void shortcutOverride(QQuickKeyEvent *event);
1049 void digit0Pressed(QQuickKeyEvent *event);
1050 void digit1Pressed(QQuickKeyEvent *event);
1051 void digit2Pressed(QQuickKeyEvent *event);
1052 void digit3Pressed(QQuickKeyEvent *event);
1053 void digit4Pressed(QQuickKeyEvent *event);
1054 void digit5Pressed(QQuickKeyEvent *event);
1055 void digit6Pressed(QQuickKeyEvent *event);
1056 void digit7Pressed(QQuickKeyEvent *event);
1057 void digit8Pressed(QQuickKeyEvent *event);
1058 void digit9Pressed(QQuickKeyEvent *event);
1060 void leftPressed(QQuickKeyEvent *event);
1061 void rightPressed(QQuickKeyEvent *event);
1062 void upPressed(QQuickKeyEvent *event);
1063 void downPressed(QQuickKeyEvent *event);
1064 void tabPressed(QQuickKeyEvent *event);
1065 void backtabPressed(QQuickKeyEvent *event);
1067 void asteriskPressed(QQuickKeyEvent *event);
1068 void numberSignPressed(QQuickKeyEvent *event);
1069 void escapePressed(QQuickKeyEvent *event);
1070 void returnPressed(QQuickKeyEvent *event);
1071 void enterPressed(QQuickKeyEvent *event);
1072 void deletePressed(QQuickKeyEvent *event);
1073 void spacePressed(QQuickKeyEvent *event);
1074 void backPressed(QQuickKeyEvent *event);
1075 void cancelPressed(QQuickKeyEvent *event);
1076 void selectPressed(QQuickKeyEvent *event);
1077 void yesPressed(QQuickKeyEvent *event);
1078 void noPressed(QQuickKeyEvent *event);
1079 void context1Pressed(QQuickKeyEvent *event);
1080 void context2Pressed(QQuickKeyEvent *event);
1081 void context3Pressed(QQuickKeyEvent *event);
1082 void context4Pressed(QQuickKeyEvent *event);
1083 void callPressed(QQuickKeyEvent *event);
1084 void hangupPressed(QQuickKeyEvent *event);
1085 void flipPressed(QQuickKeyEvent *event);
1086 void menuPressed(QQuickKeyEvent *event);
1087 void volumeUpPressed(QQuickKeyEvent *event);
1088 void volumeDownPressed(QQuickKeyEvent *event);
1091 void keyPressed(QKeyEvent *event,
bool post) override;
1092 void keyReleased(QKeyEvent *event,
bool post) override;
1094 void inputMethodEvent(QInputMethodEvent *,
bool post) override;
1095 QVariant inputMethodQuery(Qt::InputMethodQuery query)
const override;
1097 void shortcutOverrideEvent(QKeyEvent *event) override;
1098 static QByteArray keyToSignal(
int key);
1100 bool isConnected(
const char *signalName)
const;