235 :
public QObjectPrivate
236 ,
public QQuickPaletteProviderPrivateBase<QQuickItem, QQuickItemPrivate>
238 Q_DECLARE_PUBLIC(QQuickItem)
241 static QQuickItemPrivate* get(QQuickItem *item) {
return item->d_func(); }
242 static const QQuickItemPrivate* get(
const QQuickItem *item) {
return item->d_func(); }
245 ~QQuickItemPrivate() override;
246 void init(QQuickItem *parent);
248 QQmlListProperty<QObject> data();
249 QQmlListProperty<QObject> resources();
250 QQmlListProperty<QQuickItem> children();
251 QQmlListProperty<QQuickItem> visibleChildren();
253 QQmlListProperty<QQuickState> states();
254 QQmlListProperty<QQuickTransition> transitions();
256 QString state()
const;
257 void setState(
const QString &);
259 QQuickAnchorLine left()
const;
260 QQuickAnchorLine right()
const;
261 QQuickAnchorLine horizontalCenter()
const;
262 QQuickAnchorLine top()
const;
263 QQuickAnchorLine bottom()
const;
264 QQuickAnchorLine verticalCenter()
const;
265 QQuickAnchorLine baseline()
const;
267#if QT_CONFIG(quick_shadereffect)
268 QQuickItemLayer *layer()
const;
271 void localizedTouchEvent(
const QTouchEvent *event,
bool isFiltering, QMutableTouchEvent *localized);
272 bool hasPointerHandlers()
const;
273 bool hasEnabledHoverHandlers()
const;
274 virtual void addPointerHandler(QQuickPointerHandler *h);
275 virtual void removePointerHandler(QQuickPointerHandler *h);
277 QObject *setContextMenu(QObject *menu);
280 static void data_append(QQmlListProperty<QObject> *, QObject *);
281 static qsizetype data_count(QQmlListProperty<QObject> *);
282 static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
283 static void data_clear(QQmlListProperty<QObject> *);
284 static void data_removeLast(QQmlListProperty<QObject> *);
287 static QObject *resources_at(QQmlListProperty<QObject> *, qsizetype);
288 static void resources_append(QQmlListProperty<QObject> *, QObject *);
289 static qsizetype resources_count(QQmlListProperty<QObject> *);
290 static void resources_clear(QQmlListProperty<QObject> *);
291 static void resources_removeLast(QQmlListProperty<QObject> *);
294 static void children_append(QQmlListProperty<QQuickItem> *, QQuickItem *);
295 static qsizetype children_count(QQmlListProperty<QQuickItem> *);
296 static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, qsizetype);
297 static void children_clear(QQmlListProperty<QQuickItem> *);
298 static void children_removeLast(QQmlListProperty<QQuickItem> *);
301 static qsizetype visibleChildren_count(QQmlListProperty<QQuickItem> *prop);
302 static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index);
305 static qsizetype transform_count(QQmlListProperty<QQuickTransform> *list);
306 static void transform_append(QQmlListProperty<QQuickTransform> *list, QQuickTransform *);
307 static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, qsizetype);
308 static void transform_clear(QQmlListProperty<QQuickTransform> *list);
310 void _q_resourceObjectDeleted(QObject *);
311 quint64 _q_createJSWrapper(QQmlV4ExecutionEnginePtr engine);
322 ImplicitWidth = 0x100,
323 ImplicitHeight = 0x200,
328 AllChanges = 0xFFFFFFFF
331 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
332 friend inline QDebug &operator<<(QDebug &dbg, QQuickItemPrivate::ChangeTypes types) {
333#define CHANGETYPE_OUTPUT(Type) if (types & QQuickItemPrivate::Type) { dbg << first << #Type ; first = '|'; }
334 QDebugStateSaver state(dbg);
335 dbg.noquote().nospace();
336 if (types == QQuickItemPrivate::AllChanges) {
337 dbg <<
" AllChanges";
354#undef CHANGETYPE_OUTPUT
359 struct ChangeListener {
360 using ChangeTypes = QQuickItemPrivate::ChangeTypes;
362 ChangeListener(QQuickItemChangeListener *l =
nullptr, ChangeTypes t = { })
365 , gTypes(QQuickGeometryChange::All)
368 ChangeListener(QQuickItemChangeListener *l, QQuickGeometryChange gt)
374 bool operator==(
const ChangeListener &other)
const
375 {
return listener == other.listener && types == other.types; }
377 QQuickItemChangeListener *listener;
379 QQuickGeometryChange gTypes;
381#ifndef QT_NO_DEBUG_STREAM
383 friend QDebug operator<<(QDebug debug,
const QQuickItemPrivate::ChangeListener &listener);
388 template <
typename Fn,
typename ...Args>
389 void notifyChangeListeners(QQuickItemPrivate::ChangeTypes changeTypes, Fn &&function, Args &&...args)
392 if (changeListeners.isEmpty())
395 const auto listeners = changeListeners;
396 for (
const QQuickItemPrivate::ChangeListener &change : listeners) {
397 Q_ASSERT(change.listener);
398 if (change.types & changeTypes) {
399#ifdef QT_BUILD_INTERNAL
400 if (changeTypes == AllChanges && change.listener->anchorPrivate() ==
nullptr) {
403 }
else if (change.listener->baseDeleted(q)) {
404 auto output = qCritical();
406 output <<
"Listener already tagged as destroyed when called!"
407 <<
"\n\tListener:" << change.listener->debugName()
408 <<
"\n\tChanges:" << change.types
409 <<
"\n\tCaller: " << q
410 <<
"\n\tChanges:" << changeTypes;
413 if constexpr (std::is_member_function_pointer_v<Fn>)
414 (change.listener->*function)(args...);
416 function(change, args...);
418 if (changeTypes & QQuickItemPrivate::Destroyed)
419 change.listener->removeSourceItem(q);
424 Q_QUICK_EXPORT ExtraData();
431 QQuickContents *contents;
432 QQuickScreenAttached *screenAttached;
433 QQuickLayoutMirroringAttached* layoutDirectionAttached;
434 QQuickEnterKeyAttached *enterKeyAttached;
435 QQuickItemKeyFilter *keyHandler;
436 QVector<QQuickPointerHandler *> pointerHandlers;
437 QObject *contextMenu;
438#if QT_CONFIG(quick_shadereffect)
439 mutable QQuickItemLayer *layer;
444 QPointF userTransformOriginPoint;
450 int recursiveEffectRefCount;
452 int maskContainsIndex;
455 QPointer<QObject> mask;
457 QSGOpacityNode *opacityNode;
458 QQuickDefaultClipNode *clipNode;
459 QSGRootNode *rootNode;
461 QQuickDeliveryAgent *subsceneDeliveryAgent =
nullptr;
463 QObjectList resourcesList;
469 Qt::MouseButtons acceptedMouseButtons;
470 Qt::MouseButtons acceptedMouseButtonsWithoutHandlers;
473 uint transparentForPositioner : 1;
480 LeftMouseButtonAccepted = 0x2
482 Q_DECLARE_FLAGS(ExtraDataTags, ExtraDataTag)
484 QLazilyAllocated<ExtraData, ExtraDataTags> extra;
486 virtual void registerAsContainmentMask(QQuickItem * ,
bool ) { }
488 QQuickAnchors *anchors()
const;
489 mutable QQuickAnchors *_anchors;
491 inline Qt::MouseButtons acceptedMouseButtons()
const;
493 QVector<QQuickItemPrivate::ChangeListener> changeListeners;
495 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
496 void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
497 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
498 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
499 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
501 QQuickStateGroup *_states();
502 QQuickStateGroup *_stateGroup;
504 inline QQuickItem::TransformOrigin origin()
const;
508 quint32 widthValidFlag:1;
509 quint32 heightValidFlag:1;
510 quint32 componentComplete:1;
513 quint32 hoverEnabled:1;
515 quint32 antialiasing:1;
518 quint32 activeFocus:1;
519 quint32 notifiedFocus:1;
520 quint32 notifiedActiveFocus:1;
521 quint32 filtersChildMouseEvents:1;
522 quint32 explicitVisible:1;
523 quint32 effectiveVisible:1;
524 quint32 explicitEnable:1;
525 quint32 effectiveEnable:1;
526 quint32 polishScheduled:1;
527 quint32 inheritedLayoutMirror:1;
528 quint32 effectiveLayoutMirror:1;
529 quint32 isMirrorImplicit:1;
530 quint32 inheritMirrorFromParent:1;
531 quint32 inheritMirrorFromItem:1;
532 quint32 isAccessible:1;
536 quint32 subtreeCursorEnabled:1;
537 quint32 subtreeHoverEnabled:1;
538 quint32 activeFocusOnTab:1;
539 quint32 implicitAntialiasing:1;
540 quint32 antialiasingValid:1;
546 quint32 isTabFence:1;
547 quint32 replayingPressEvent:1;
549 quint32 touchEnabled:1;
550 quint32 hasCursorHandler:1;
552 quint32 maybeHasSubsceneDeliveryAgent:1;
555 quint32 subtreeTransformChangedEnabled:1;
556 quint32 inDestructor:1;
557 quint32 focusReason:4;
558 quint32 focusPolicy:4;
562 TransformOrigin = 0x00000001,
563 Transform = 0x00000002,
564 BasicTransform = 0x00000004,
565 Position = 0x00000008,
569 Content = 0x00000040,
571 OpacityValue = 0x00000100,
572 ChildrenChanged = 0x00000200,
573 ChildrenStackingChanged = 0x00000400,
574 ParentChanged = 0x00000800,
579 EffectReference = 0x00008000,
580 Visible = 0x00010000,
581 HideReference = 0x00020000,
582 Antialiasing = 0x00040000,
586 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
588 ComplexTransformUpdateMask = Transform | Window,
589 ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing,
590 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
593 quint32 dirtyAttributes;
594 QString dirtyToString()
const;
595 void dirty(DirtyType);
596 void addToDirtyList();
597 void removeFromDirtyList();
598 QQuickItem *nextDirtyItem;
599 QQuickItem**prevDirtyItem;
601 void setCulled(
bool);
603 QQuickWindow *window;
605 inline QSGContext *sceneGraphContext()
const;
606 inline QSGRenderContext *sceneGraphRenderContext()
const;
608 QQuickItem *parentItem;
610 QList<QQuickItem *> childItems;
611 mutable QList<QQuickItem *> *sortedChildItems;
612 QList<QQuickItem *> paintOrderChildItems()
const;
613 void addChild(QQuickItem *);
614 void removeChild(QQuickItem *);
615 void siblingOrderChanged();
617 inline void markSortedChildrenDirty(QQuickItem *child);
619 void refWindow(QQuickWindow *);
622 qreal effectiveDevicePixelRatio()
const;
624 QPointer<QQuickItem> subFocusItem;
625 void updateSubFocusItem(QQuickItem *scope,
bool focus);
627 bool setFocusIfNeeded(QEvent::Type);
628 Qt::FocusReason lastFocusChangeReason()
const;
629 virtual bool setLastFocusChangeReason(Qt::FocusReason reason);
631 QTransform windowToItemTransform()
const;
632 QTransform itemToWindowTransform()
const;
633 void itemToParentTransform(QTransform *)
const;
635 static bool focusNextPrev(QQuickItem *item,
bool forward);
636 static QQuickItem *nextTabChildItem(
const QQuickItem *item,
int start);
637 static QQuickItem *prevTabChildItem(
const QQuickItem *item,
int start);
638 static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item,
bool forward,
bool wrap =
true);
640 static bool canAcceptTabFocus(QQuickItem *item);
642 void setX(qreal x) {q_func()->setX(x);}
643 void xChanged() { Q_EMIT q_func()->xChanged(); }
644 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, x, &QQuickItemPrivate::setX, &QQuickItemPrivate::xChanged);
645 void setY(qreal y) {q_func()->setY(y);}
646 void yChanged() { Q_EMIT q_func()->yChanged(); }
647 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, y, &QQuickItemPrivate::setY, &QQuickItemPrivate::yChanged);
648 void setWidth(qreal width) {q_func()->setWidth(width);}
649 void widthChanged() { Q_EMIT q_func()->widthChanged(); }
650 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, width, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged);
651 void setHeight(qreal height) {q_func()->setHeight(height);}
652 void heightChanged() { Q_EMIT q_func()->heightChanged(); }
653 Q_OBJECT_COMPAT_PROPERTY(QQuickItemPrivate, qreal, height, &QQuickItemPrivate::setHeight, &QQuickItemPrivate::heightChanged);
655 qreal implicitHeight;
657 bool widthValid()
const {
return widthValidFlag || (width.hasBinding() && !QQmlPropertyBinding::isUndefined(width.binding()) ); }
658 bool heightValid()
const {
return heightValidFlag || (height.hasBinding() && !QQmlPropertyBinding::isUndefined(height.binding()) ); }
660 qreal baselineOffset;
662 QList<QQuickTransform *> transforms;
664 inline qreal z()
const {
return extra.isAllocated()?extra->z:0; }
665 inline qreal scale()
const {
return extra.isAllocated()?extra->scale:1; }
666 inline qreal rotation()
const {
return extra.isAllocated()?extra->rotation:0; }
667 inline qreal opacity()
const {
return extra.isAllocated()?extra->opacity:1; }
669 void setAccessible();
671 virtual qreal getImplicitWidth()
const;
672 virtual qreal getImplicitHeight()
const;
673 virtual void implicitWidthChanged();
674 virtual void implicitHeightChanged();
676#if QT_CONFIG(accessibility)
677 QAccessible::Role effectiveAccessibleRole()
const;
679 virtual QAccessible::Role accessibleRole()
const;
683 void setImplicitAntialiasing(
bool antialiasing);
685 void resolveLayoutMirror();
686 void setImplicitLayoutMirror(
bool mirror,
bool inherit);
687 void setLayoutMirror(
bool mirror);
688 bool isMirrored()
const {
689 return effectiveLayoutMirror;
692 void emitChildrenRectChanged(
const QRectF &rect) {
694 Q_EMIT q->childrenRectChanged(rect);
697 QPointF computeTransformOrigin()
const;
698 virtual bool transformChanged(QQuickItem *transformedItem);
700 QPointF adjustedPosForTransform(
const QPointF ¢roid,
701 const QPointF &startPos,
const QVector2D &activeTranslatation,
702 qreal startScale, qreal activeScale,
703 qreal startRotation, qreal activeRotation);
705 QQuickDeliveryAgent *deliveryAgent();
706 QQuickDeliveryAgentPrivate *deliveryAgentPrivate();
707 QQuickDeliveryAgent *ensureSubsceneDeliveryAgent();
709 void deliverKeyEvent(QKeyEvent *);
710 bool filterKeyEvent(QKeyEvent *,
bool post);
712 void deliverInputMethodEvent(QInputMethodEvent *);
714 void deliverShortcutOverrideEvent(QKeyEvent *);
716 void deliverPointerEvent(QEvent *);
718 bool anyPointerHandlerWants(
const QPointerEvent *event,
const QEventPoint &point)
const;
719 virtual bool handlePointerEvent(QPointerEvent *,
bool avoidGrabbers =
false);
720#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
721 virtual bool handleContextMenuEvent(QContextMenuEvent *event);
724 virtual void setVisible(
bool visible);
726 bool isTransparentForPositioner()
const;
727 void setTransparentForPositioner(
bool trans);
729 bool calcEffectiveVisible()
const;
730 bool setEffectiveVisibleRecur(
bool);
731 bool calcEffectiveEnable()
const;
732 void setEffectiveEnableRecur(QQuickItem *scope,
bool);
735 inline QSGTransformNode *itemNode();
736 inline QSGNode *childContainerNode();
739
740
741
742
743
744
746 QSGOpacityNode *opacityNode()
const {
return extra.isAllocated()?extra->opacityNode:
nullptr; }
747 QQuickDefaultClipNode *clipNode()
const {
return extra.isAllocated()?extra->clipNode:
nullptr; }
748 QSGRootNode *rootNode()
const {
return extra.isAllocated()?extra->rootNode:
nullptr; }
750 QSGTransformNode *itemNodeInstance;
753 virtual QSGTransformNode *createTransformNode();
757 void refFromEffectItem(
bool hide);
758 void recursiveRefFromEffectItem(
int refs);
759 void derefFromEffectItem(
bool unhide);
761 void itemChange(QQuickItem::ItemChange,
const QQuickItem::ItemChangeData &);
763 void enableSubtreeChangeNotificationsForParentHierachy();
765 virtual void mirrorChange() {}
767 void setHasCursorInChild(
bool hasCursor);
768 void setHasHoverInChild(
bool hasHover);
770 QCursor effectiveCursor(
const QQuickPointerHandler *handler)
const;
771 QQuickPointerHandler *effectiveCursorHandler()
const;
774 virtual void updatePolish() { }
775 virtual void dumpItemTree(
int indent)
const;
777 QLayoutPolicy sizePolicy()
const;
778 void setSizePolicy(
const QLayoutPolicy::Policy &horizontalPolicy,
const QLayoutPolicy::Policy &verticalPolicy);
779 QLayoutPolicy szPolicy;
968 Q_DECLARE_PRIVATE(QQuickKeysAttached)
970 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
971 Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo FINAL)
972 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
974 QML_NAMED_ELEMENT(Keys)
975 QML_ADDED_IN_VERSION(2, 0)
976 QML_UNCREATABLE(
"Keys is only available via attached properties")
977 QML_ATTACHED(QQuickKeysAttached)
980 QQuickKeysAttached(QObject *parent=
nullptr);
981 ~QQuickKeysAttached() override;
983 bool enabled()
const { Q_D(
const QQuickKeysAttached);
return d->enabled; }
984 void setEnabled(
bool enabled) {
985 Q_D(QQuickKeysAttached);
986 if (enabled != d->enabled) {
987 d->enabled = enabled;
988 Q_EMIT enabledChanged();
992 enum Priority { BeforeItem, AfterItem};
994 Priority priority()
const;
995 void setPriority(Priority);
997 QQmlListProperty<QQuickItem> forwardTo() {
998 Q_D(QQuickKeysAttached);
999 return QQmlListProperty<QQuickItem>(
this, &(d->targets));
1002 void componentComplete() override;
1004 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
1007 void enabledChanged();
1008 void priorityChanged();
1009 void pressed(QQuickKeyEvent *event);
1010 void released(QQuickKeyEvent *event);
1011 void shortcutOverride(QQuickKeyEvent *event);
1012 void digit0Pressed(QQuickKeyEvent *event);
1013 void digit1Pressed(QQuickKeyEvent *event);
1014 void digit2Pressed(QQuickKeyEvent *event);
1015 void digit3Pressed(QQuickKeyEvent *event);
1016 void digit4Pressed(QQuickKeyEvent *event);
1017 void digit5Pressed(QQuickKeyEvent *event);
1018 void digit6Pressed(QQuickKeyEvent *event);
1019 void digit7Pressed(QQuickKeyEvent *event);
1020 void digit8Pressed(QQuickKeyEvent *event);
1021 void digit9Pressed(QQuickKeyEvent *event);
1023 void leftPressed(QQuickKeyEvent *event);
1024 void rightPressed(QQuickKeyEvent *event);
1025 void upPressed(QQuickKeyEvent *event);
1026 void downPressed(QQuickKeyEvent *event);
1027 void tabPressed(QQuickKeyEvent *event);
1028 void backtabPressed(QQuickKeyEvent *event);
1030 void asteriskPressed(QQuickKeyEvent *event);
1031 void numberSignPressed(QQuickKeyEvent *event);
1032 void escapePressed(QQuickKeyEvent *event);
1033 void returnPressed(QQuickKeyEvent *event);
1034 void enterPressed(QQuickKeyEvent *event);
1035 void deletePressed(QQuickKeyEvent *event);
1036 void spacePressed(QQuickKeyEvent *event);
1037 void backPressed(QQuickKeyEvent *event);
1038 void cancelPressed(QQuickKeyEvent *event);
1039 void selectPressed(QQuickKeyEvent *event);
1040 void yesPressed(QQuickKeyEvent *event);
1041 void noPressed(QQuickKeyEvent *event);
1042 void context1Pressed(QQuickKeyEvent *event);
1043 void context2Pressed(QQuickKeyEvent *event);
1044 void context3Pressed(QQuickKeyEvent *event);
1045 void context4Pressed(QQuickKeyEvent *event);
1046 void callPressed(QQuickKeyEvent *event);
1047 void hangupPressed(QQuickKeyEvent *event);
1048 void flipPressed(QQuickKeyEvent *event);
1049 void menuPressed(QQuickKeyEvent *event);
1050 void volumeUpPressed(QQuickKeyEvent *event);
1051 void volumeDownPressed(QQuickKeyEvent *event);
1054 void keyPressed(QKeyEvent *event,
bool post) override;
1055 void keyReleased(QKeyEvent *event,
bool post) override;
1057 void inputMethodEvent(QInputMethodEvent *,
bool post) override;
1058 QVariant inputMethodQuery(Qt::InputMethodQuery query)
const override;
1060 void shortcutOverrideEvent(QKeyEvent *event) override;
1061 static QByteArray keyToSignal(
int key);
1063 bool isConnected(
const char *signalName)
const;