Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Multiple Model Same delegate on QML MapView

Multiple Model Same delegate on QML MapView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 511 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neel.basu
    wrote on last edited by neel.basu
    #1

    I have a model on C++ side which is based on AbstractListModel. The model have a set of locations through a role that is being shown in a MapView. Following is the minimal version of my code. markerModel: MarkerModel is defined on 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 draws points for each positions in the model. Now I want to have multiple such models.

    1. I can have an AbstractTableModel on C++ instead of AbstractListModel view will loop through its columns and call markerDelegate on each column. Or do the same with row.
    2. Have multiple models dynamically exposed to QML rendered on a single view with a single delegate markerDelegate

    Which one of these is standard practice ? or feasible ? How to achieve any one of these ?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved