summaryrefslogtreecommitdiff
path: root/examples/location/mapviewer
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-11-15 07:45:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-06 01:38:32 +0100
commit545e3f0540a1bd8e431391e325038fabca915867 (patch)
treed41d8d88921de1a407f30e8d8e39a5bdce7bf2a5 /examples/location/mapviewer
parent4a1f2da3df92eed75cb7d473ae77c63e48fdd97a (diff)
downloadqtlocation-545e3f0540a1bd8e431391e325038fabca915867.tar.gz
Remove the GeoMapMouseArea
I don't see a reason for keeping this. First of all, only half of it is implemented. Second we can have the same behavior with a normal MouseArea. The only advantage a MapMouseArea has is that mouse events are only received in the boundaries of the parent map item. However with a bit of work in the parent map item we can have this behavior as well for a normal mouse area. The only thing we are eventually loosing is the geocoordinate property of the MapMouseEvent. But this can be easily obtained with the "toCoordinate" function in the Map item. Change-Id: Icb176ee7d7c2881df714ab3191fa1f7f5c8915e2 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/location/mapviewer')
-rw-r--r--examples/location/mapviewer/content/map/ImageItem.qml2
-rw-r--r--examples/location/mapviewer/content/map/MapComponent.qml13
-rw-r--r--examples/location/mapviewer/content/map/Marker.qml5
-rw-r--r--examples/location/mapviewer/content/map/MiniMap.qml3
-rw-r--r--examples/location/mapviewer/content/map/PolygonItem.qml2
-rw-r--r--examples/location/mapviewer/content/map/RectangleItem.qml2
6 files changed, 13 insertions, 14 deletions
diff --git a/examples/location/mapviewer/content/map/ImageItem.qml b/examples/location/mapviewer/content/map/ImageItem.qml
index a7146fbf..81e9f1c1 100644
--- a/examples/location/mapviewer/content/map/ImageItem.qml
+++ b/examples/location/mapviewer/content/map/ImageItem.qml
@@ -43,7 +43,7 @@ import QtLocation 5.0
MapQuickItem { //to be used inside MapComponent only
id: imageItem
- MapMouseArea {
+ MouseArea {
anchors.fill: parent
drag.target: parent
}
diff --git a/examples/location/mapviewer/content/map/MapComponent.qml b/examples/location/mapviewer/content/map/MapComponent.qml
index e51373a7..6d7d7baa 100644
--- a/examples/location/mapviewer/content/map/MapComponent.qml
+++ b/examples/location/mapviewer/content/map/MapComponent.qml
@@ -298,7 +298,7 @@ Map {
smooth: true
opacity: 0.8
//! [routedelegate0]
- MapMouseArea {
+ MouseArea {
id: routeMouseArea
anchors.fill: parent
hoverEnabled: false
@@ -346,7 +346,7 @@ Map {
opacity: 0.6
center: locationData.coordinate
//! [pointdel0]
- MapMouseArea {
+ MouseArea {
anchors.fill:parent
id: circleMouseArea
hoverEnabled: false
@@ -365,7 +365,8 @@ Map {
Math.abs(map.pressX - parent.x- mouse.x ) > map.jitterThreshold ||
Math.abs(map.pressY - parent.y -mouse.y ) > map.jitterThreshold) {
map.state = ""
- if (pressed) parent.radius = parent.center.distanceTo(mouseToCoordinate(mouse))
+ if (pressed) parent.radius = parent.center.distanceTo(
+ map.toCoordinate(Qt.point(mouse.x, mouse.y)))
}
if ((mouse.button == Qt.LeftButton) & (map.state == "")) {
map.lastX = mouse.x + parent.x
@@ -844,7 +845,7 @@ Map {
}
}
- MapMouseArea {
+ MouseArea {
id: mouseArea
property variant lastCoordinate
anchors.fill: parent
@@ -856,7 +857,7 @@ Map {
map.lastY = mouse.y
map.pressX = mouse.x
map.pressY = mouse.y
- lastCoordinate = mouseArea.mouseToCoordinate(mouse)
+ lastCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y))
// if (mouse.button == Qt.MiddleButton)
// addMarker()
}
@@ -879,7 +880,7 @@ Map {
}
onDoubleClicked: {
- map.center = mouseArea.mouseToCoordinate(mouse)
+ map.center = map.toCoordinate(Qt.point(mouse.x, mouse.y))
if (mouse.button == Qt.LeftButton){
map.zoomLevel += 1
} else if (mouse.button == Qt.RightButton) map.zoomLevel -= 1
diff --git a/examples/location/mapviewer/content/map/Marker.qml b/examples/location/mapviewer/content/map/Marker.qml
index d7a1e838..ece34819 100644
--- a/examples/location/mapviewer/content/map/Marker.qml
+++ b/examples/location/mapviewer/content/map/Marker.qml
@@ -57,7 +57,7 @@ MapQuickItem {
id: image
//! [mqi-anchor]
source: markerMouseArea.containsMouse ? (markerMouseArea.pressed ? "../../resources/marker_selected.png" :"../../resources/marker_hovered.png") : "../../resources/marker.png"
- MapMouseArea {
+ MouseArea {
id: markerMouseArea
property int pressX : -1
property int pressY : -1
@@ -108,7 +108,8 @@ MapQuickItem {
}
//! [mqi-closeimage]
- Component.onCompleted: coordinate = mouseArea.lastCoordinate
+ Component.onCompleted: coordinate = map.toCoordinate(Qt.point(markerMouseArea.mouseX,
+ markerMouseArea.mouseY));
//! [mqi-close]
}
//! [mqi-close]
diff --git a/examples/location/mapviewer/content/map/MiniMap.qml b/examples/location/mapviewer/content/map/MiniMap.qml
index e5d03e49..5bee404c 100644
--- a/examples/location/mapviewer/content/map/MiniMap.qml
+++ b/examples/location/mapviewer/content/map/MiniMap.qml
@@ -62,9 +62,6 @@ Rectangle{
center: map.center
plugin: map.plugin
gesture.enabled: false
- MapMouseArea{
- anchors.fill: parent
- }
MapRectangle {
color: "#44ff0000"
diff --git a/examples/location/mapviewer/content/map/PolygonItem.qml b/examples/location/mapviewer/content/map/PolygonItem.qml
index b6e41ea6..9b52bbca 100644
--- a/examples/location/mapviewer/content/map/PolygonItem.qml
+++ b/examples/location/mapviewer/content/map/PolygonItem.qml
@@ -55,7 +55,7 @@ MapPolygon {
addCoordinate(markers[i].coordinate)
}
}
- MapMouseArea {
+ MouseArea {
anchors.fill:parent
id: mousearea
drag.target: parent
diff --git a/examples/location/mapviewer/content/map/RectangleItem.qml b/examples/location/mapviewer/content/map/RectangleItem.qml
index 97896883..1b58f468 100644
--- a/examples/location/mapviewer/content/map/RectangleItem.qml
+++ b/examples/location/mapviewer/content/map/RectangleItem.qml
@@ -65,7 +65,7 @@ MapRectangle {
(bottomRight.longitude == 153.3021))
}
- MapMouseArea {
+ MouseArea {
anchors.fill:parent
id: mousearea
hoverEnabled: false