Details
-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.8
-
None
Description
Summary
There were nice recent additions to the language allowing developers to load types and create objects by module URI and type name, such as QQmlComponent::loadFromModule(QAnyStringView uri, QAnyStringView typeName) (since 6.5).
I believe we need such counterpart for the attached objects, as presently it is still not clear how to request them reliably.
The following signature would be sufficient:
QObject *qmlAttachedPropertiesObject(QAnyStringView uri, QAnyStringView typeName, QObject *object);
Workarounds
Currently the only way to get an attached object without being able to link to its library and #include its C++ type is through some obscure hacks which might even fail if the corresponding QML import is missing or has an alias. For example, check out how KDE/Plasma applets interact with properties of QtQuick.Layouts/Layout attached type: