1
votes

I can draw a polygon on a map, this polygon is a rectangular which I can rotate it or rescale it. The point is that I want to draw a qpixmap in this rectangular as background but I have no idea how to do it, Is it even possible?there is not any property in MapPolygon which I can assign an qpixmap into it.

Map {
    id: mapBase
    gesture.enabled: true
    anchors.fill: parent
    plugin: mapPlugin
    center: QtPositioning.coordinate(45,10)
    zoomLevel: 4
    z: parent.z + 1
    MapPolygon {
        color: 'green'
        path: [
            { latitude: -27, longitude: 153.0 },
            { latitude: -27, longitude: 154.1 },
            { latitude: -28, longitude: 153.5 }
        ]
    }
}
1
show your code.eyllanesc
@eyllanesc thanks I have updated my postMajid Hojati

1 Answers

2
votes

You could use an OpacityMask, conjointly with a QML Image

    MapPolygon {
        id: polygon
        color: 'white' // Any color, only alpha channel will be used
        path: [
            { latitude: -27, longitude: 153.0 },
            { latitude: -27, longitude: 154.1 },
            { latitude: -28, longitude: 153.5 }
        ]
        visible: false
    }

    Image {
        id: image
        source: "myImage.png"
        visible: false // hide it so it does not appear over the masked image
    }

    OpacityMask  // Actual masked image
    {
        source: image
        maskSource: polygon
        anchors.fill: polygon
    }