Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
-
Windows 10
Description
According to doc:
An ObjectModel contains the visual items to be used in a view. When an ObjectModel is used in a view, the view does not require a delegate since the ObjectModel already contains the visual delegate (items).
That doesn't seem to be the case when ObjectModel is used to source a DelegateModel, it doesn't seem to be able to forward the actual objects to serve as delegates.
What's more, if a delegate component is provided to the DelegateModel, the view ultimately shows the delegate item, but the count of items does not correspond to the number of objects in the ObjectModel as expected.
Column { spacing: 10 Row { // works as expected Repeater { model: ObjectModel { Rectangle { width: 100; height: 100; color: "red" } Rectangle { width: 100; height: 100; color: "blue" } } } } Row { // nothing Repeater { model: DelegateModel { model: ObjectModel { Rectangle { width: 100; height: 100; color: "red" } Rectangle { width: 100; height: 100; color: "blue" } } } } } Row { // one item only Repeater { model: DelegateModel { model: ObjectModel { Rectangle { width: 100; height: 100; color: "red" } Rectangle { width: 100; height: 100; color: "blue" } } delegate: Rectangle { width: 100; height: 100; color: "green" } } } } }
The end result - first row is as expected, second row is missing altogether, third row shows incorrect number of items.
Also, I tried attaching a 2kb PNG image of the result, just to get a "Jira could not attach the file as there was a missing token. Please try attaching the file again." so maybe that's also something worth looking into...
So here's a link to an external image uploading service instead:
Edit: upload succeeded only after the bug was posted!