7#include <qqmlregistration.h>
9#include "qml_material/export.hpp"
16class AttachedPropertyRegistry;
18class QML_MATERIAL_API AttachedPropertyNode :
public QObject {
22 Q_PROPERTY(QObject* inheritFrom READ inheritFrom WRITE setInheritFrom RESET resetInheritFrom
23 NOTIFY inheritFromChanged FINAL)
26 AttachedPropertyNode(QObject* target,
const QMetaObject* attachedType);
27 ~AttachedPropertyNode()
override;
29 QObject* target()
const;
31 QObject* inheritFrom()
const;
32 void setInheritFrom(QObject* source);
33 void resetInheritFrom();
35 AttachedPropertyNode* attachedParent()
const;
36 QList<AttachedPropertyNode*> attachedChildren()
const;
38 Q_SIGNAL
void inheritFromChanged();
41 void initializeAttachedProperty();
42 void propagateAttachedValues();
44 virtual void updateInheritedValues() = 0;
47 void refreshPropagation();
50 friend class AttachedPropertyRegistry;
52 QPointer<QObject> m_target;
53 QPointer<QObject> m_inherit_from;
54 QObject* m_registered_target {
nullptr };
55 const QMetaObject* m_attached_type {
nullptr };
56 AttachedPropertyRegistry* m_registry {
nullptr };
57 QPointer<AttachedPropertyNode> m_attached_parent;
58 QList<QPointer<AttachedPropertyNode>> m_attached_children;
59 QPointer<QQuickItem> m_content_root;
60 QList<QMetaObject::Connection> m_target_connections;
61 QMetaObject::Connection m_registry_destroyed;
62 QMetaObject::Connection m_content_root_destroyed;
63 QMetaObject::Connection m_inherit_from_destroyed;
64 bool m_initialized {
false };
65 bool m_cycle_warning_issued {
false };
66 bool m_cross_engine_warning_issued {
false };