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;
488 LeftMouseButtonAccepted = 0x2
490 Q_DECLARE_FLAGS(ExtraDataTags, ExtraDataTag)
492 QLazilyAllocated<ExtraData, ExtraDataTags> extra;
494 virtual void registerAsContainmentMask(QQuickItem * ,
bool ) { }
496 QQuickAnchors *anchors()
const;
497 mutable QQuickAnchors *_anchors;
499 inline Qt::MouseButtons acceptedMouseButtons()
const;
501 QList<QQuickItemPrivate::ChangeListener> changeListeners;
503 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
504 void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
505 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
506 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
507 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
509 QQuickStateGroup *_states();
510 QQuickStateGroup *_stateGroup;
512 inline QQuickItem::TransformOrigin origin()
const;
516 quint32 widthValidFlag:1;
517 quint32 heightValidFlag:1;
518 quint32 componentComplete:1;
521 quint32 hoverEnabled:1;
523 quint32 antialiasing:1;
526 quint32 activeFocus:1;
527 quint32 notifiedFocus:1;
528 quint32 notifiedActiveFocus:1;
529 quint32 filtersChildMouseEvents:1;
530 quint32 explicitVisible:1;
531 quint32 effectiveVisible:1;
532 quint32 explicitEnable:1;
533 quint32 effectiveEnable:1;
534 quint32 polishScheduled:1;
535 quint32 inheritedLayoutMirror:1;
536 quint32 effectiveLayoutMirror:1;
537 quint32 isMirrorImplicit:1;
538 quint32 inheritMirrorFromParent:1;
539 quint32 inheritMirrorFromItem:1;
540 quint32 isAccessible:1;
544 quint32 subtreeCursorEnabled:1;
545 quint32 subtreeHoverEnabled:1;
546 quint32 activeFocusOnTab:1;
547 quint32 implicitAntialiasing:1;
548 quint32 antialiasingValid:1;
554 quint32 isTabFence:1;
555 quint32 replayingPressEvent:1;
557 quint32 touchEnabled:1;
558 quint32 hasCursorHandler:1;
560 quint32 maybeHasSubsceneDeliveryAgent:1;
563 quint32 subtreeTransformChangedEnabled:1;
564 quint32 inDestructor:1;
565 quint32 focusReason:4;
566 quint32 focusPolicy:4;
571 mutable quint32 eventHandlingChildrenWithinBounds:1;
572 mutable quint32 eventHandlingChildrenWithinBoundsSet:1;
574 quint32 customOverlay:1;
577 static bool customOverlayRequested;
578 void requestCustomOverlay();
581 TransformOrigin = 0x00000001,
582 Transform = 0x00000002,
583 BasicTransform = 0x00000004,
584 Position = 0x00000008,
588 Content = 0x00000040,
590 OpacityValue = 0x00000100,
591 ChildrenChanged = 0x00000200,
592 ChildrenStackingChanged = 0x00000400,
593 ParentChanged = 0x00000800,
598 EffectReference = 0x00008000,
599 Visible = 0x00010000,
600 HideReference = 0x00020000,
601 Antialiasing = 0x00040000,
605 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
607 ComplexTransformUpdateMask = Transform | Window,
608 ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing,
609 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
612 quint32 dirtyAttributes;
613 QString dirtyToString()
const;
614 void dirty(DirtyType);
615 void addToDirtyList();
616 void removeFromDirtyList();
617 QQuickItem *nextDirtyItem;
618 QQuickItem**prevDirtyItem;
620 void setCulled(
bool);
622 QQuickWindow *window;
624 inline QSGContext *sceneGraphContext()
const;
625 inline QSGRenderContext *sceneGraphRenderContext()
const;
627 QQuickItem *parentItem;
629 QList<QQuickItem *> childItems;
630 mutable QList<QQuickItem *> *sortedChildItems;
631 QList<QQuickItem *> paintOrderChildItems()
const;
632 void addChild(QQuickItem *);
633 void removeChild(QQuickItem *);
634 void siblingOrderChanged();
636 inline void markSortedChildrenDirty(QQuickItem *child);
638 void refWindow(QQuickWindow *);
641 qreal effectiveDevicePixelRatio()
const;
643 QPointer<QQuickItem> subFocusItem;
644 void updateSubFocusItem(QQuickItem *scope,
bool focus);
646 bool setFocusIfNeeded(QEvent::Type);
647 Qt::FocusReason lastFocusChangeReason()
const;
648 virtual bool setLastFocusChangeReason(Qt::FocusReason reason);
650 QTransform windowToItemTransform()
const;
651 QTransform itemToWindowTransform()
const;
652 void itemToParentTransform(QTransform *)
const;
654 static bool focusNextPrev(QQuickItem *item,
bool forward);
655 static QQuickItem *nextTabChildItem(
const QQuickItem *item,
int start);
656 static QQuickItem *prevTabChildItem(
const QQuickItem *item,
int start);
657 static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item,
bool forward,
bool wrap =
true);
659 static bool canAcceptTabFocus(QQuickItem *item);
661 void setX(qreal x) {q_func()->setX(x);}
662 void xChanged() { Q_EMIT q_func()->xChanged(); }
663 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, x, &QQuickItemPrivate::setX, &QQuickItemPrivate::xChanged);
664 void setY(qreal y) {q_func()->setY(y);}
665 void yChanged() { Q_EMIT q_func()->yChanged(); }
666 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, y, &QQuickItemPrivate::setY, &QQuickItemPrivate::yChanged);
667 void setWidth(qreal width) {q_func()->setWidth(width);}
668 void widthChanged() { Q_EMIT q_func()->widthChanged(); }
669 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, width, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged);
670 void setHeight(qreal height) {q_func()->setHeight(height);}
671 void heightChanged() { Q_EMIT q_func()->heightChanged(); }
672 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, height, &QQuickItemPrivate::setHeight, &QQuickItemPrivate::heightChanged);
674 qreal implicitHeight;
676 bool widthValid()
const {
return widthValidFlag || (width.hasBinding() && !QQmlPropertyBinding::isUndefined(width.binding()) ); }
677 bool heightValid()
const {
return heightValidFlag || (height.hasBinding() && !QQmlPropertyBinding::isUndefined(height.binding()) ); }
679 qreal baselineOffset;
681 QList<QQuickTransform *> transforms;
683 inline qreal z()
const {
return extra.isAllocated()?extra->z:0; }
684 inline qreal scale()
const {
return extra.isAllocated()?extra->scale:1; }
685 inline qreal rotation()
const {
return extra.isAllocated()?extra->rotation:0; }
686 inline qreal opacity()
const {
return extra.isAllocated()?extra->opacity:1; }
688 void setAccessible();
690 virtual qreal getImplicitWidth()
const;
691 virtual qreal getImplicitHeight()
const;
692 virtual void implicitWidthChanged();
693 virtual void implicitHeightChanged();
695#if QT_CONFIG(accessibility)
696 QAccessible::Role effectiveAccessibleRole()
const;
698 virtual QAccessible::Role accessibleRole()
const;
702 void setImplicitAntialiasing(
bool antialiasing);
704 void resolveLayoutMirror();
705 void setImplicitLayoutMirror(
bool mirror,
bool inherit);
706 void setLayoutMirror(
bool mirror);
707 bool isMirrored()
const {
708 return effectiveLayoutMirror;
711 void emitChildrenRectChanged(
const QRectF &rect) {
713 Q_EMIT q->childrenRectChanged(rect);
716 QPointF computeTransformOrigin()
const;
717 virtual bool transformChanged(QQuickItem *transformedItem);
719 QPointF adjustedPosForTransform(
const QPointF ¢roid,
720 const QPointF &startPos,
const QVector2D &activeTranslatation,
721 qreal startScale, qreal activeScale,
722 qreal startRotation, qreal activeRotation);
724 QQuickDeliveryAgent *deliveryAgent();
725 QQuickDeliveryAgentPrivate *deliveryAgentPrivate();
726 QQuickDeliveryAgent *ensureSubsceneDeliveryAgent();
728 void deliverKeyEvent(QKeyEvent *);
729 bool filterKeyEvent(QKeyEvent *,
bool post);
731 void deliverInputMethodEvent(QInputMethodEvent *);
733 void deliverShortcutOverrideEvent(QKeyEvent *);
735 void deliverPointerEvent(QEvent *);
737 bool anyPointerHandlerWants(
const QPointerEvent *event,
const QEventPoint &point)
const;
738 virtual bool handlePointerEvent(QPointerEvent *,
bool avoidGrabbers =
false);
739#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
740 virtual bool handleContextMenuEvent(QContextMenuEvent *event);
743 virtual void setVisible(
bool visible);
745 bool isTransparentForPositioner()
const;
746 void setTransparentForPositioner(
bool trans);
748 bool calcEffectiveVisible()
const;
749 bool setEffectiveVisibleRecur(
bool);
750 bool calcEffectiveEnable()
const;
751 void setEffectiveEnableRecur(QQuickItem *scope,
bool);
753 qreal biggestPointerHandlerMargin()
const;
754 QRectF eventHandlingBounds(qreal margin = 0)
const;
755 bool parentFullyContains()
const;
756 bool effectivelyClipsEventHandlingChildren()
const;
758 inline QSGTransformNode *itemNode();
759 inline QSGNode *childContainerNode();
762
763
764
765
766
767
769 QSGOpacityNode *opacityNode()
const {
return extra.isAllocated()?extra->opacityNode:
nullptr; }
770 QQuickDefaultClipNode *clipNode()
const {
return extra.isAllocated()?extra->clipNode:
nullptr; }
771 QSGRootNode *rootNode()
const {
return extra.isAllocated()?extra->rootNode:
nullptr; }
773 QSGTransformNode *itemNodeInstance;
776 virtual QSGTransformNode *createTransformNode();
780 void refFromEffectItem(
bool hide);
781 void recursiveRefFromEffectItem(
int refs);
782 void derefFromEffectItem(
bool unhide);
784 void itemChange(QQuickItem::ItemChange,
const QQuickItem::ItemChangeData &);
786 void enableSubtreeChangeNotificationsForParentHierachy();
788 virtual void mirrorChange() {}
790 void setHasCursorInChild(
bool hasCursor);
791 void setHasHoverInChild(
bool hasHover);
793 QCursor effectiveCursor(
const QQuickPointerHandler *handler)
const;
794 QQuickPointerHandler *effectiveCursorHandler()
const;
797 virtual void updatePolish() { }
798 virtual void dumpItemTree(
int indent)
const;
800 QLayoutPolicy sizePolicy()
const;
801 void setSizePolicy(
const QLayoutPolicy::Policy &horizontalPolicy,
const QLayoutPolicy::Policy &verticalPolicy);
802 QLayoutPolicy szPolicy;
804#ifdef QT_BUILD_INTERNAL
805 inline static quint32 item_counter = 0;
806 inline static quint32 itemExtra_counter = 0;
807 inline static quint32 eventHandlingChildrenWithinBounds_counter = 0;
808 inline static quint64 itemToParentTransform_counter = 0;
809 inline static quint64 itemToWindowTransform_counter = 0;
810 inline static quint64 windowToItemTransform_counter = 0;
811 inline static quint64 effectiveClippingSkips_counter = 0;
1001 Q_DECLARE_PRIVATE(QQuickKeysAttached)
1003 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
1004 Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo FINAL)
1005 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
1007 QML_NAMED_ELEMENT(Keys)
1008 QML_ADDED_IN_VERSION(2, 0)
1009 QML_UNCREATABLE(
"Keys is only available via attached properties")
1010 QML_ATTACHED(QQuickKeysAttached)
1013 QQuickKeysAttached(QObject *parent=
nullptr);
1014 ~QQuickKeysAttached() override;
1016 bool enabled()
const { Q_D(
const QQuickKeysAttached);
return d->enabled; }
1017 void setEnabled(
bool enabled) {
1018 Q_D(QQuickKeysAttached);
1019 if (enabled != d->enabled) {
1020 d->enabled = enabled;
1021 Q_EMIT enabledChanged();
1025 enum Priority { BeforeItem, AfterItem};
1027 Priority priority()
const;
1028 void setPriority(Priority);
1030 QQmlListProperty<QQuickItem> forwardTo() {
1031 Q_D(QQuickKeysAttached);
1032 return QQmlListProperty<QQuickItem>(
this, &(d->targets));
1035 void componentComplete() override;
1037 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
1040 void enabledChanged();
1041 void priorityChanged();
1042 void pressed(QQuickKeyEvent *event);
1043 void released(QQuickKeyEvent *event);
1044 void shortcutOverride(QQuickKeyEvent *event);
1045 void digit0Pressed(QQuickKeyEvent *event);
1046 void digit1Pressed(QQuickKeyEvent *event);
1047 void digit2Pressed(QQuickKeyEvent *event);
1048 void digit3Pressed(QQuickKeyEvent *event);
1049 void digit4Pressed(QQuickKeyEvent *event);
1050 void digit5Pressed(QQuickKeyEvent *event);
1051 void digit6Pressed(QQuickKeyEvent *event);
1052 void digit7Pressed(QQuickKeyEvent *event);
1053 void digit8Pressed(QQuickKeyEvent *event);
1054 void digit9Pressed(QQuickKeyEvent *event);
1056 void leftPressed(QQuickKeyEvent *event);
1057 void rightPressed(QQuickKeyEvent *event);
1058 void upPressed(QQuickKeyEvent *event);
1059 void downPressed(QQuickKeyEvent *event);
1060 void tabPressed(QQuickKeyEvent *event);
1061 void backtabPressed(QQuickKeyEvent *event);
1063 void asteriskPressed(QQuickKeyEvent *event);
1064 void numberSignPressed(QQuickKeyEvent *event);
1065 void escapePressed(QQuickKeyEvent *event);
1066 void returnPressed(QQuickKeyEvent *event);
1067 void enterPressed(QQuickKeyEvent *event);
1068 void deletePressed(QQuickKeyEvent *event);
1069 void spacePressed(QQuickKeyEvent *event);
1070 void backPressed(QQuickKeyEvent *event);
1071 void cancelPressed(QQuickKeyEvent *event);
1072 void selectPressed(QQuickKeyEvent *event);
1073 void yesPressed(QQuickKeyEvent *event);
1074 void noPressed(QQuickKeyEvent *event);
1075 void context1Pressed(QQuickKeyEvent *event);
1076 void context2Pressed(QQuickKeyEvent *event);
1077 void context3Pressed(QQuickKeyEvent *event);
1078 void context4Pressed(QQuickKeyEvent *event);
1079 void callPressed(QQuickKeyEvent *event);
1080 void hangupPressed(QQuickKeyEvent *event);
1081 void flipPressed(QQuickKeyEvent *event);
1082 void menuPressed(QQuickKeyEvent *event);
1083 void volumeUpPressed(QQuickKeyEvent *event);
1084 void volumeDownPressed(QQuickKeyEvent *event);
1087 void keyPressed(QKeyEvent *event,
bool post) override;
1088 void keyReleased(QKeyEvent *event,
bool post) override;
1090 void inputMethodEvent(QInputMethodEvent *,
bool post) override;
1091 QVariant inputMethodQuery(Qt::InputMethodQuery query)
const override;
1093 void shortcutOverrideEvent(QKeyEvent *event) override;
1094 static QByteArray keyToSignal(
int key);
1096 bool isConnected(
const char *signalName)
const;