What is the difference between Component
and Item
in QML ? The documentation is not absolutely clear here.
What is the preferred type to use as a container for several widgets?
Can it be replacable by Rectangle
?
For example, what is the difference in the following declarations:
Item {
id: itemWidget
Rectangle { id: one }
Rectangle { id: two }
}
and
Component {
id: componentWidget
Rectangle { id: one }
Rectangle { id: two }
}
Why do we usually use Component
when declaring a delegate
?