diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2012-02-14 13:58:22 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 00:22:40 +0100 |
commit | f2f8d5dc1c74024827019378424dcf59ba3096ed (patch) | |
tree | a73bb19ba75a8b4dc664f6201bb5bd6cde139fb4 /src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp | |
parent | 9b7cf2b63fb9f9ff7b3c5f05b8e916c85c66403b (diff) | |
download | qtlocation-f2f8d5dc1c74024827019378424dcf59ba3096ed.tar.gz |
Convert QGeoBoundingArea to use value type semantics.
This simplifies the API while keeping the same functionality.
Objects of type QGeoBoundingCircle and QGeoBoundingBox can still
be passed around as QGeoBoundingArea without losing their identity.
QGeoBoundingArea::isValid(), ::isEmpty() and ::contains() function
as one would expect.
This change removes the necessity of the application developer to
track and delete pointers.
Change-Id: I1ee70af90319da4c77225c6a0a03601d5ff431f1
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp')
-rw-r--r-- | src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp b/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp index 32ebc635..fd761f6a 100644 --- a/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp @@ -51,7 +51,8 @@ QT_BEGIN_NAMESPACE -QGeocodeReplyNokia::QGeocodeReplyNokia(QNetworkReply *reply, int limit, int offset, QGeoBoundingArea *viewport, QObject *parent) +QGeocodeReplyNokia::QGeocodeReplyNokia(QNetworkReply *reply, int limit, int offset, + const QGeoBoundingArea &viewport, QObject *parent) : QGeocodeReply(parent), m_reply(reply) { @@ -102,10 +103,10 @@ void QGeocodeReplyNokia::networkFinished() QGeoCodeXmlParser parser; if (parser.parse(m_reply)) { QList<QGeoLocation> locations = parser.results(); - QGeoBoundingArea *bounds = viewport(); - if (bounds) { + QGeoBoundingArea bounds = viewport(); + if (bounds.isValid()) { for (int i = locations.size() - 1; i >= 0; --i) { - if (!bounds->contains(locations[i].coordinate())) + if (!bounds.contains(locations[i].coordinate())) locations.removeAt(i); } } |