Attached property reuse

[attached-property-reuse] Attached type was initialized multiple times.

This warning category is spelled [attached-property-reuse] by qmllint.

Using attached type already initialized in a parent scope

What happened?

You initialized a propagating attached type multiple times.

Note

This mostly happens for attached types that inherit from QQuickAttachedPropertyPropagator.

Why is this bad?

Propagating attached objects consume memory for each instantiation but only need to be initialized once.

Example

To fix this warning, query the attached type from the parent: