summaryrefslogtreecommitdiff
path: root/src/imports/location
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2012-02-14 13:58:22 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-20 00:22:40 +0100
commitf2f8d5dc1c74024827019378424dcf59ba3096ed (patch)
treea73bb19ba75a8b4dc664f6201bb5bd6cde139fb4 /src/imports/location
parent9b7cf2b63fb9f9ff7b3c5f05b8e916c85c66403b (diff)
downloadqtlocation-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/imports/location')
-rw-r--r--src/imports/location/qdeclarativegeoboundingarea_p.h2
-rw-r--r--src/imports/location/qdeclarativegeoboundingbox.cpp4
-rw-r--r--src/imports/location/qdeclarativegeoboundingbox_p.h2
-rw-r--r--src/imports/location/qdeclarativegeoboundingcircle.cpp4
-rw-r--r--src/imports/location/qdeclarativegeoboundingcircle_p.h2
-rw-r--r--src/imports/location/qdeclarativegeocodemodel.cpp8
-rw-r--r--src/imports/location/qdeclarativegeocodemodel_p.h2
7 files changed, 12 insertions, 12 deletions
diff --git a/src/imports/location/qdeclarativegeoboundingarea_p.h b/src/imports/location/qdeclarativegeoboundingarea_p.h
index 1f6a4d32..a88f1a17 100644
--- a/src/imports/location/qdeclarativegeoboundingarea_p.h
+++ b/src/imports/location/qdeclarativegeoboundingarea_p.h
@@ -56,7 +56,7 @@ class QDeclarativeGeoBoundingArea : public QObject
public:
QDeclarativeGeoBoundingArea(QObject *parent) :QObject(parent){}
- virtual QGeoBoundingArea *area() const = 0;
+ virtual QGeoBoundingArea area() const = 0;
};
QT_END_NAMESPACE
diff --git a/src/imports/location/qdeclarativegeoboundingbox.cpp b/src/imports/location/qdeclarativegeoboundingbox.cpp
index ceb70e5f..750a8faf 100644
--- a/src/imports/location/qdeclarativegeoboundingbox.cpp
+++ b/src/imports/location/qdeclarativegeoboundingbox.cpp
@@ -95,9 +95,9 @@ QGeoBoundingBox QDeclarativeGeoBoundingBox::box()
return m_box;
}
-QGeoBoundingArea *QDeclarativeGeoBoundingBox::area() const
+QGeoBoundingArea QDeclarativeGeoBoundingBox::area() const
{
- return m_box.clone();
+ return m_box;
}
/*!
diff --git a/src/imports/location/qdeclarativegeoboundingbox_p.h b/src/imports/location/qdeclarativegeoboundingbox_p.h
index 639b2ca6..ba09ecf3 100644
--- a/src/imports/location/qdeclarativegeoboundingbox_p.h
+++ b/src/imports/location/qdeclarativegeoboundingbox_p.h
@@ -69,7 +69,7 @@ public:
explicit QDeclarativeGeoBoundingBox(const QGeoBoundingBox &box, QObject *parent = 0);
void setBox(const QGeoBoundingBox& box);
QGeoBoundingBox box();
- virtual QGeoBoundingArea *area() const;
+ QGeoBoundingArea area() const;
Q_INVOKABLE bool contains(QDeclarativeCoordinate* coordinate);
QDeclarativeCoordinate* bottomLeft();
diff --git a/src/imports/location/qdeclarativegeoboundingcircle.cpp b/src/imports/location/qdeclarativegeoboundingcircle.cpp
index 8b923dda..898fa6ee 100644
--- a/src/imports/location/qdeclarativegeoboundingcircle.cpp
+++ b/src/imports/location/qdeclarativegeoboundingcircle.cpp
@@ -93,9 +93,9 @@ QGeoBoundingCircle QDeclarativeGeoBoundingCircle::circle() const
return m_circle;
}
-QGeoBoundingArea *QDeclarativeGeoBoundingCircle::area() const
+QGeoBoundingArea QDeclarativeGeoBoundingCircle::area() const
{
- return m_circle.clone();
+ return circle();
}
/*!
diff --git a/src/imports/location/qdeclarativegeoboundingcircle_p.h b/src/imports/location/qdeclarativegeoboundingcircle_p.h
index 9a459ad5..4a671339 100644
--- a/src/imports/location/qdeclarativegeoboundingcircle_p.h
+++ b/src/imports/location/qdeclarativegeoboundingcircle_p.h
@@ -65,7 +65,7 @@ public:
explicit QDeclarativeGeoBoundingCircle(const QGeoBoundingCircle &circle, QObject *parent = 0);
void setCircle(const QGeoBoundingCircle& circle);
QGeoBoundingCircle circle() const;
- virtual QGeoBoundingArea *area() const;
+ QGeoBoundingArea area() const;
Q_INVOKABLE bool contains(QDeclarativeCoordinate* coordinate);
QDeclarativeCoordinate* center();
diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp
index cd8a666f..1529d738 100644
--- a/src/imports/location/qdeclarativegeocodemodel.cpp
+++ b/src/imports/location/qdeclarativegeocodemodel.cpp
@@ -141,14 +141,14 @@ void QDeclarativeGeocodeModel::componentComplete()
update();
}
-QGeoBoundingArea* QDeclarativeGeocodeModel::boundingArea()
+QGeoBoundingArea QDeclarativeGeocodeModel::boundingArea()
{
if (qobject_cast<QDeclarativeGeoBoundingBox*>(boundingArea_) && boundingBox_.isValid()) {
- return &boundingBox_;
+ return boundingBox_;
} else if (qobject_cast<QDeclarativeGeoBoundingCircle*>(boundingArea_) && boundingCircle_.isValid()) {
- return &boundingCircle_;
+ return boundingCircle_;
}
- return 0;
+ return QGeoBoundingArea();
}
/*!
diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h
index ea15e53f..13d727bc 100644
--- a/src/imports/location/qdeclarativegeocodemodel_p.h
+++ b/src/imports/location/qdeclarativegeocodemodel_p.h
@@ -170,7 +170,7 @@ protected:
private:
void setLocations(const QList<QGeoLocation> &locations);
- QGeoBoundingArea* boundingArea();
+ QGeoBoundingArea boundingArea();
void abortRequest();
QGeocodeReply* reply_;