Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126779

Feature Request: qmlAttachedPropertiesObject overload to get an attached property (object) by module URI and type name

    XMLWordPrintable

Details

    • All

    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:

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            ratijas ivan tkachenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes