Details
-
Suggestion
-
Resolution: Duplicate
-
P3: Somewhat important
-
4.7.0
-
None
Description
From the documentation for the Component element:
The Component element allows defining components within a QML file. This can be useful for reusing a small component within a single QML file, or for defining a component that logically belongs with the file containing it.
However, Components embedded in an Item have different semantics from those coming from external files:
- Embedded components don't define a type, instead their use requires a Loader element. This feels quite unnatural and prevents setting properties directly.
Why does a component defined in the current file have to be "loaded" while external ones be used directly?
- Components defined in external files require trivial wrappers to be used as delegates in ListViews. Why can't a type be used directly as a delegate? If absolutely necessary, the trivial wrapper could be created implicitly.
I think sorting out these differences makes for a more useful more pleasurable declarative language