Reputation: 415
This is a best practices question. In QML, is it preferable to use the Item type as the root element for all custom QML components or is it acceptable to use say, Rectangle, ColumnLayout, or anything else as the root element? After all, Rectangle and ColumnLayout inherit from Item so in a sense, if either one of those are used, its still an Item root element. Are there any known drawbacks for not using the actual Item QML type (base type) as a custom component's root element?
Upvotes: 0
Views: 751
Reputation: 24396
No. You should use whatever works best for your requirements. There are things to keep in mind for users of that components (such as default properties, sizing behaviour, etc.), but nothing that says you should use Item
as the root element.
Upvotes: 1