2017-10-12 14 views
0

マップ上にポリゴンを描くことができます。このポリゴンは、それを回転させるか再スケーリングすることができる長方形です。 ポイントは、この四角形の背景にqpixmapを描画したいが、それをどうするかわからない。それは可能か?MapPolygonにqpixmapを割り当てることができるプロパティはない。MapPolygon QMLイメージの背景

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 } 
     ] 
    } 
} 
+0

で、OpacityMaskを使用することができます。 – eyllanesc

+0

@eyllanescありがとう私は私のポストを更新しました –

答えて

1

あなたはあなたのコードを表示する共同QMLイメージ

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 
    } 
+0

非常に感謝しています。 –

関連する問題