I have a XmlListModel that fetches data from a webserver, which works great.
However, I want to use that in a CLComboBox (from the Colibri library).
If I set the parameter ListModel to my XmlListModel I get:
Non-existent attached object
ListModel:xmlModel13
But it does exists; since a ListView-object can use the very same model.
It seems to me that the CLComboBox only accepts a ListModel, so is there any way to transform a XmlListModel to a ListModel easily?
You can populate the ListModel inside the CLComboBox using a loop.
You cannot cast
QDeclarativeXmlListModel
toQDeclarativeListModel
because they both direct descendants ofQListModelInterface
.In my opinion Colibri should use a
QObject
(variant
property) instead ofQDeclarativeListModel
. And listen for standard item-based-model signals e.g. I believe it could be fixed with some effort.If you not willing to contribute to Colibri, I think @sabbour's answer is best option. Consider simple example: