Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.14.1
-
None
-
Linux 64-bit
Description
If one set a MouseArea inside MapPolygon (that is not a rectangle shape) and check mouse events, it will find that click events are respecting polygon shape and enter/leave events are not. Actually, enter/leave events fire in respect of the minimal rectangle that covers all points of polygon.
Here some minimal reproducing snippet:
import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Window 2.12 import QtLocation 5.12 import QtPositioning 5.12 Window { id: window width: 800 height: 600 Map { plugin: Plugin { name: "osm" } anchors.fill: parent zoomLevel: 8.0 center: QtPositioning.coordinate(60.0, 30.0) MapPolygon { id: poly property bool hovered: false property bool selected: false color: { if (hovered && selected) return Material.color(Material.Yellow, Material.Shade300) else if(hovered) return Material.color(Material.Red, Material.Shade300) else if(selected) return Material.color(Material.Yellow) else return Material.color(Material.Red) } path: [ { latitude: 60.5, longitude: 30 }, { latitude: 59.5, longitude: 30 }, { latitude: 60, longitude: 30.5 } ] MouseArea { id: ma anchors.fill: parent hoverEnabled: true onEntered: { poly.hovered = true } onExited: { poly.hovered = false } onClicked: { poly.selected = !poly.selected } } } } }