summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-05-31 16:06:02 +0200
committerPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-06-02 19:25:07 +0000
commit07b9d583273b8e3aa5712eac9d06b74ddb927db3 (patch)
tree9958505c35cbe5ce6abb452555eb29099d8db8d1
parentef471a0254c7c3a5978d06980f1e7e32229f21b4 (diff)
downloadqtlocation-07b9d583273b8e3aa5712eac9d06b74ddb927db3.tar.gz
fix for losing map item focus while dragging them
QDeclarativeGeoMapItemBase::childMouseEventFilter currently does a contain() check on the clicks but also on the mouse move events. by not doing it on mouse move events the problem seems fixed, but the autotests get broken because it seems that the map doesn't get panned anymore but the element gets dragged instead. Task-number: QTBUG-52075 Change-Id: I5ce340ca591ec924eebed1fe7acda18d31301fc5 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/imports/location/qdeclarativegeomapitembase.cpp1
-rw-r--r--tests/auto/declarative_ui/tst_map_item_details.qml28
2 files changed, 22 insertions, 7 deletions
diff --git a/src/imports/location/qdeclarativegeomapitembase.cpp b/src/imports/location/qdeclarativegeomapitembase.cpp
index 3cd29ce3..8e825f5b 100644
--- a/src/imports/location/qdeclarativegeomapitembase.cpp
+++ b/src/imports/location/qdeclarativegeomapitembase.cpp
@@ -201,7 +201,6 @@ bool QDeclarativeGeoMapItemBase::childMouseEventFilter(QQuickItem *item, QEvent
switch (event->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
- case QEvent::MouseMove:
if (contains(static_cast<QMouseEvent*>(event)->pos())) {
return false;
} else {
diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml
index fd9b0064..3927db69 100644
--- a/tests/auto/declarative_ui/tst_map_item_details.qml
+++ b/tests/auto/declarative_ui/tst_map_item_details.qml
@@ -283,7 +283,7 @@ Item {
Text {id: progressText}
TestCase {
- name: "MapItemDeatils"
+ name: "MapItemDetails"
when: windowShown
/*
@@ -464,19 +464,22 @@ Item {
verify(extMapCircleDateline.center.longitude === 180)
map.center = datelineCoordinate
point = map.fromCoordinate(extMapCircleDateline.center)
- verify(point.x == map.width / 2.0)
- extMapCircleDateline.center.longitude = datelineCoordinateRight.longitude
+ verify(point.x == map.width / 2.0) // center of the screen
+ visualInspectionPoint()
+ extMapCircleDateline.center.longitude = datelineCoordinateRight.longitude // -170, moving the circle to the right
point = map.fromCoordinate(extMapCircleDateline.center)
- verify(point.x > map.width / 2.0)
verify(LocationTestHelper.waitForPolished(map))
+ verify(point.x > map.width / 2.0)
+ visualInspectionPoint()
mousePress(map, point.x, point.y)
- for (i=0; i < 40; i += 4) {
+ for (i=0; i < 50; i += 4) {
wait(1)
mouseMove(map, point.x - i, point.y)
}
mouseRelease(map, point.x - i, point.y)
verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapCircleDateline.center)
+ visualInspectionPoint()
verify(point.x < map.width / 2.0)
map.removeMapItem(extMapCircleDateline)
@@ -486,18 +489,21 @@ Item {
verify(extMapQuickItemDateline.coordinate.longitude === 175)
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x < map.width / 2.0)
+ visualInspectionPoint()
extMapQuickItemDateline.coordinate.longitude = datelineCoordinateRight.longitude
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x > map.width / 2.0)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint()
mousePress(map, point.x + 5, point.y + 5)
- for (i=0; i < 50; i += 5) {
+ for (i=0; i < 64; i += 5) {
wait(1)
mouseMove(map, point.x + 5 - i, point.y + 5 )
}
mouseRelease(map, point.x + 5 - i, point.y + 5)
verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
+ visualInspectionPoint()
verify(point.x < map.width / 2.0)
map.removeMapItem(extMapQuickItemDateline)
@@ -741,5 +747,15 @@ Item {
console.log('map fuzzy cmp returns false for value, ref, tolerance: ' + val + ', ' + ref + ', ' + tolerance)
return false;
}
+ // call to visualInspectionPoint testcase (for dev time visual inspection)
+ function visualInspectionPoint(time) {
+ var waitTime = 0 // 300
+ if (time !== undefined)
+ waitTime = time
+ if (waitTime > 0) {
+ console.log('halting for ' + waitTime + ' milliseconds')
+ wait (waitTime)
+ }
+ }
}
}