Search code examples
c++dictionaryqmlblackberry-10

Add Pin on Map Location in QML BB10


i am new to BB10 development, i am developing an application that has a map and i want to my current location on the map from the QML file

on there developers site there is way to add a pin from the C++ files but i want to make it in the QMLor to have the map in the QMLand connect it to C++ where i can add the pin

below is my map in the QML file

can anyone help me

    Container {
        layout: StackLayout {
        }
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
        MapView {
            id: mapview
            objectName: "mapViewObj"
            altitude: 3000
            latitude: 45.342614
            longitude: -75.914991
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: verticalAlignment.Fill
            minHeight: 500
            altitudeMode: altitude.MAX_VALUE

        }

    }

Solution

  • One of the sample apps shows exactly how to do this and also how to add controls.

    There is too much code to copy/paste an example here, but in essence what you do is create a container for your pin and then use absolute positioning and/or animation translations to move the pin with the map.

    http://blackberry.github.io/Cascades-Samples/custommapview.html

    This is all done in QML and javascript as far as I can tell.