qt5-cadaques
qt5-cadaques copied to clipboard
Imprecise definition of the term Component
back-link: ch04/index.html#components
In QML, we made a mistake when we gave the typename "Component" to an object type which (functionally) is an object-instance-factory. Unfortunately, it's too late to change it, and so it's helpful to have greater precision when discussing what Components are in QML.
A QML document which defines a re-usable type is separate from an object-instance-factory. Furthermore, an instance of any given QML type could be considered a component (lowercase-c) or an element (although I personally prefer "object instance" I understand that HTML5/CSS developers may be more comfortable with one of the previous terms..), but not a (capital-c) Component.
Thanks for the comments. Component of "Component" is really a confusing term.
Here is my view on this morning:)
For me a component is an reusable element (I liked elements more than types as it better suites the UI language in my opinion). A component can be placed in a external document or inside a document. If it's placed inside a document it needs to be marked as a component using the "Component" element to not get picked up by the renderer and to give it a type id for instantiation. In most cases I prefer the external document as it gives more flexibility.