Qt QML图像单击像素
我有一个图像,它被加载到一个快速地图项目中,我只想在用户点击图像时找到像素的行和列,我怎么能得到它? 谢谢 这是我的密码Qt QML图像单击像素,qt,qml,qqmlcomponent,Qt,Qml,Qqmlcomponent,我有一个图像,它被加载到一个快速地图项目中,我只想在用户点击图像时找到像素的行和列,我怎么能得到它? 谢谢 这是我的密码 MapQuickItem{ id:yes anchorPoint.x: image.width/10 anchorPoint.y: image.height/10 zoomLevel:1 //width: 1 //height: 1 sourceItem: Image { id:image
MapQuickItem{
id:yes
anchorPoint.x: image.width/10
anchorPoint.y: image.height/10
zoomLevel:1
//width: 1
//height: 1
sourceItem: Image {
id:image
asynchronous:true
opacity: 80
source: "qrc:/../../../../../Desktop/1.png"
transformOrigin: Item.Center
rotation: 0
scale: 0.25
//width: 500
//height: 200
sourceSize.width: image.width/2
visible: false
//sourceSize.height:100
}
coordinate: QtPositioning.coordinate(59.91, 10.75)
}
您想获取原始图像的像素还是显示的图像?@eyllanesc它们有什么区别吗?我可以得到哪一个?如果您注意到在代码中放置了以下内容:sourceSize.width:image.width/2,因此该图像已被扭曲。是否仅获取单击位置,或者也要获取颜色?如果你想要位置:你需要什么位置,是源图像还是视觉图像?@eyllanesc我想要源图像单击像素的行和列,我还不需要它的颜色。你想要原始图像的像素还是显示的图像?@eyllanesc它们有什么区别吗?我可以得到哪一个?如果您注意到在代码中放置了以下内容:sourceSize.width:image.width/2,因此该图像已被扭曲。是否仅获取单击位置,或者也要获取颜色?如果你想要位置:你需要什么位置,是源位置还是视觉位置?@eyllanesc我想要源图像点击像素的行和列,我还不需要它的颜色。