Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Multiple models in Map (QtLocation)



  • Hi,

    Map supports model and delegate parameters, but how shall I go about with multiple models?
    e.g. one from c++ for my stuff and one for showing flickr images (as in positioning example, but with lon+lat data).
    Additionally I would like flickr to be optional.

    Shall I merge those two into a single model? In qml or use C++ for flickr too instead of XmlListModel? How would I use different delegates?

    Or draw the data without model/delegate helpers? how?

    Thanks,
    Alex



  • sorry so stupid... that explains why I found no explanation on how to do this :D

    for reference: model + delegate are not parameters of Map but of MapItemView and one can simply add multiple MapItemViews to one Map.



  • You can use several models (or even a repeater) as childs of a Map. Making one model tobe optional can be done directly inside a model.
    If you want more details, you could have a look to the workshop materials in this topic : https://forum.qt.io/topic/63838/qt-qml-workshop-materials



  • @Alexander_Lanin didn't see you already found it before I submit my reply...