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

Items with `required` properties cannot be used inside a `Loader`

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.15.3, 6.0.2
    • None
    • All

      Using a component with `required` properties inside a `Loader` and using a `Binding

      { ... }

      ` results in:
      ```
      Required property someProp was not initialized
      ```

      There currently does not seem to be a declarative way to use such component inside a `Loader`. Considering how the `required` keyword can be used to make components re-usable, and the fact that `Loader` has use cases with no other alternatives, this limitation of `Loader` reduces the re-usability of such components. So for example if you are using a library that has been designed to be safe and re-usable using the `required` keyword (rightly so), you would not be able to use purely declarative QML and the `Loader` component.

      An imperative alternative would be to use `setSource` in the `Loader`.

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

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

              Created:
              Updated:

                There are no open Gerrit changes