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. How do I add markers to a map?
Forum Update on Monday, May 27th 2025

How do I add markers to a map?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 1 Posters 1.1k 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.
  • M Offline
    M Offline
    Mihaill
    wrote on last edited by
    #1

    Hi!
    How do I add markers to a map?
    I use a map in QML.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mihaill
      wrote on last edited by
      #2

      It is works https://stackoverflow.com/questions/49344638/adding-markers-places-to-qt-qml-maps
      But how to change the marker when I click on it?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mihaill
        wrote on last edited by
        #3

        It's works:

        
                Component {
                        id: mapcomponent
                        MapQuickItem {
                            id: marker
                            anchorPoint.x: image.width/4
                            anchorPoint.y: image.height
                            coordinate: position
        
                            MouseArea{
                                anchors.fill: parent
                                onClicked: {
                                    imageMarker.source = "qrc:/Images/Images/markerGreen.png"
                                    console.log("MapQuickItem clicked")}
                            }
        
                            sourceItem: Image {
                                id: imageMarker
                                source: "qrc:/Images/Images/markerRed.png"
                            }
                        }
                    }
        
        1 Reply Last reply
        1

        • Login

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