Map display of several QML models

I have a C ++ side model based on AbstractListModel . The model has a set of locations through the role that is shown in MapView . Below is the minimum version of my code. markerModel: MarkerModel is defined on the C ++ side.

 Map{ MapItemView { model: markerModel delegate: markerDelegate } Component { id: markerDelegate MapQuickItem{ anchorPoint: Qt.point(2.5, 2.5) coordinate: QtPositioning.coordinate(position.y, position.x) zoomLevel: 0 sourceItem: Rectangle{ ... } } } } 

The delegate actually scores points for each position in the model. Now I want to have several such models.

  • I can have AbstractTableModel in C ++ instead of AbstractListModel . The view will go through its columns and call markerDelegate for each column. Or do the same with the string.
  • Multiple dynamically QML models displayed on the same view using a single delegate markerDelegate

Which one is standard practice? or maybe? How to reach any of them?

+5
source share
1 answer

You can store data for each model in the container and load the corresponding data into the model object

-2
source

Source: https://habr.com/ru/post/1274983/


All Articles