Unsolved Ignore MouseArea onClicked event for transparent areas of parent Qt Quick Image
-
I've found several similar questions pertaining to this topic, but haven't pieced together a workable solution as of yet. I've got non-rectangular Qt Quick Images, each with a child MouseArea. The current onClicked event registers clicks of the parent Image in areas of transparency, which I would like to ignore. Is there a QML-only solution to do this? Would a QML-only solution be adviseable, or should the transparency determination be done in c++?
Some pseudocode as an example:
Image { id: testImage x: 200 y: 100 width: 100 height: 150 fillMode: Image.PreserveAspectFit source: "TestImage.svg" MouseArea { id: testMouseArea anchors.fill: parent onClicked: { //if alpha of (mouseX, mouseY) > 0 { //DO STUFF //} } } }
My understanding is that getImageData() won't work for this purpose, so it may not be possible to determine the alpha level of the parent Image at the (mouseX, mouseY) coordinates in QML directly.