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

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

    XMLWordPrintable

Details

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

    Description

      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`.

      Attachments

        Issue Links

          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:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes