Qt MapPolygon QML图像背景
我可以在地图上画一个多边形,这个多边形是一个矩形,我可以旋转它或重新缩放它。 问题是,我想在这个矩形中绘制一个qpixmap作为背景,但我不知道怎么做,可能吗?MapPolygon中没有任何属性可以指定qpixmap到其中Qt MapPolygon QML图像背景,qt,qml,Qt,Qml,我可以在地图上画一个多边形,这个多边形是一个矩形,我可以旋转它或重新缩放它。 问题是,我想在这个矩形中绘制一个qpixmap作为背景,但我不知道怎么做,可能吗?MapPolygon中没有任何属性可以指定qpixmap到其中 Map { id: mapBase gesture.enabled: true anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(45,10)
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 }
]
}
}
您可以使用,并结合使用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
}
显示您的代码。@eyllanesc谢谢我已经更新了我的帖子。非常感谢,如果我画一个矩形,我能把图像放进去吗?可能吗?