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

Inline component results in "unknown type"

    XMLWordPrintable

Details

    • All

    Description

      I create custom grouped properties in QML by creating a component like so:

      // MyProps.qml
          property real
          property real y
      }
      

      And then I can use it:

      // MyComponent.qml
      Item {
          id: root
          property MyProps myProps: MyProps {}
      }
      

      I tried replacing MyProps.qml with an inline component:

      // MyComponent.qml
      Item {
          id: root
          component MyProps : QtObject {
              property real x
              property real y
          }
          property MyProps myProps: MyProps {}
      }
      

      However this gives me an error on the myProps declaration line:

      Cannot assign to property of unknown type "MyComponent_QMLTYPE_1".*

      From the documentation it sounds like inline components should behave identical to components defined in a separate file so I suspect this might be a bug. Is this not accurate? If not how are they different? (maybe this can be clarified in the documentation?)

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mmi_puya Puya Daravi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes