diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-09-06 10:10:47 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-09-06 10:11:31 +0200 |
commit | de4e125aff5aa9feb2a6a36c22047d354df0cf94 (patch) | |
tree | 6fa6a0641d47d09d4325dd511a2576c4804664e7 | |
parent | ffbdf2cf0517cc773a012dc07f17532297e03d8d (diff) | |
parent | ffb10da5ad4d3ff200fbca9438538cc5102296e3 (diff) | |
download | qtlocation-de4e125aff5aa9feb2a6a36c22047d354df0cf94.tar.gz |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Ia305efe8c4b616ed70309dfcae47f39cd1a4c4da
-rw-r--r-- | examples/positioning/geoflickr/flickrmobile/GeoTab.qml | 9 | ||||
-rw-r--r-- | src/imports/location/error_messages.cpp | 2 | ||||
-rw-r--r-- | src/imports/location/error_messages.h | 4 | ||||
-rw-r--r-- | src/imports/location/qdeclarativepolygonmapitem.cpp | 15 | ||||
-rw-r--r-- | src/imports/location/qdeclarativepolylinemapitem.cpp | 14 | ||||
-rw-r--r-- | src/location/doc/src/qml-maps.qdoc | 3 | ||||
-rw-r--r-- | tests/auto/declarative_core/tst_routing.qml | 9 |
7 files changed, 23 insertions, 33 deletions
diff --git a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml index 1226120d..4505319f 100644 --- a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml +++ b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml @@ -94,6 +94,15 @@ Rectangle { id: positionSource onPositionChanged: { planet.source = "images/sun.png"; } + onSourceErrorChanged: { + if (sourceError == PositionSource.NoError) + return + + console.log("Source error: " + sourceError) + activityText.fadeOut = true + stop() + } + onUpdateTimeout: { activityText.fadeOut = true } diff --git a/src/imports/location/error_messages.cpp b/src/imports/location/error_messages.cpp index 5b2c139d..a2557f79 100644 --- a/src/imports/location/error_messages.cpp +++ b/src/imports/location/error_messages.cpp @@ -48,7 +48,5 @@ const char PLUGIN_NOT_VALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is no const char CATEGORIES_NOT_INITIALIZED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to initialize categories"); const char UNABLE_TO_MAKE_REQUEST[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to create request"); const char INDEX_OUT_OF_RANGE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Index '%1' out of range"); -//often used but only visible to developer -> no translation required -const char COORD_NOT_BELONG_TO[] = "Coordinate does not belong to %1"; QT_END_NAMESPACE diff --git a/src/imports/location/error_messages.h b/src/imports/location/error_messages.h index 357db173..81c43b34 100644 --- a/src/imports/location/error_messages.h +++ b/src/imports/location/error_messages.h @@ -33,10 +33,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef ERROR_MESSAGES_H #define ERROR_MESSAGES_H -#include <QString> +#include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE @@ -46,7 +47,6 @@ extern const char PLUGIN_ERROR[]; extern const char PLUGIN_PROVIDER_ERROR[]; extern const char PLUGIN_NOT_VALID[]; extern const char CATEGORIES_NOT_INITIALIZED[]; -extern const char COORD_NOT_BELONG_TO[]; extern const char UNABLE_TO_MAKE_REQUEST[]; extern const char INDEX_OUT_OF_RANGE[]; diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 5b94d009..9a71614f 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -448,26 +448,19 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate) /*! \qmlmethod void MapPolygon::removeCoordinate(coordinate) - Removes a coordinate from the path. If there are multiple instances of the + Removes \a coordinate from the path. If there are multiple instances of the same coordinate, the one added last is removed. - \sa addCoordinate, path + If \a coordinate is not in the path this method does nothing. + \sa addCoordinate, path */ - void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordinate) { int index = path_.lastIndexOf(coordinate); - - if (index == -1) { - qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem"); + if (index == -1) return; - } - if (path_.count() < index + 1) { - qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem"); - return; - } path_.removeAt(index); geometry_.markSourceDirty(); diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index dd041e7e..9201701c 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -570,25 +570,19 @@ void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate /*! \qmlmethod void MapPolyline::removeCoordinate(coordinate) - Removes a coordinate from the path. If there are multiple instances of the + Removes \a coordinate from the path. If there are multiple instances of the same coordinate, the one added last is removed. + If \a coordinate is not in the path this method does nothing. + \sa addCoordinate, path */ - void QDeclarativePolylineMapItem::removeCoordinate(const QGeoCoordinate &coordinate) { int index = path_.lastIndexOf(coordinate); - - if (index == -1) { - qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem"); + if (index == -1) return; - } - if (path_.count() < index + 1) { - qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem"); - return; - } path_.removeAt(index); geometry_.markSourceDirty(); diff --git a/src/location/doc/src/qml-maps.qdoc b/src/location/doc/src/qml-maps.qdoc index ebae9582..9b6232f5 100644 --- a/src/location/doc/src/qml-maps.qdoc +++ b/src/location/doc/src/qml-maps.qdoc @@ -48,8 +48,7 @@ Map item you can center the map, zoom, pinch and make the item flickable. The places to be added to the map are \l {Maps and Navigation (QML)#Putting Objects on a Map (Map Overlay Objects)}{MapItems}. The item's position is defined by a \l {coordinate}{coordinate} which includes latitude, -longitude and altitude. The item is then displayed automatically after it is added to the Map. -\l {Maps and Navigation (QML)#Putting Objects on a Map (Map Overlay Objects)}{MapItems} or \l Map. +longitude and altitude. The item is then displayed automatically after it is added to the \l Map. \section2 Position on map diff --git a/tests/auto/declarative_core/tst_routing.qml b/tests/auto/declarative_core/tst_routing.qml index f29c7dd3..3567bc1a 100644 --- a/tests/auto/declarative_core/tst_routing.qml +++ b/tests/auto/declarative_core/tst_routing.qml @@ -622,8 +622,7 @@ Item { compare (routeModelSlack.count, 0) // Check that results are cleared routeModelSlack.update() - wait (300) - compare (routeModelSlack.count, 3) // numberALternativeRoutes + tryCompare(routeModelSlack, "count", 3) // numberALternativeRoutes routeModelSlack.reset() compare (routeModelSlack.count, 0) // Check that changing plugin resets any ongoing requests @@ -716,8 +715,7 @@ Item { wait (100) compare (testRoutesSlackSpy.count, 0) compare (testCountSlackSpy.count, 0) - wait (200) - compare (testRoutesSlackSpy.count, 1) + tryCompare(testRoutesSlackSpy, "count", 1) compare (testCountSlackSpy.count, 1) compare(routeModelSlack.count, 1) compare (routeModelSlack.get(0).path.length, 5) @@ -743,8 +741,7 @@ Item { wait (100) compare(testRoutesSlackSpy.count, 0) compare(testCountSlackSpy.count, 0) - wait (200) - compare (testRoutesSlackSpy.count, 1) + tryCompare(testRoutesSlackSpy, "count", 1) compare(testCountSlackSpy.count, 1) compare(routeModelSlack.count, 1) |