diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2012-01-12 11:18:36 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-16 03:06:06 +0100 |
commit | 8dc617c3e4e4b75d8dbad3ed277056969d7d95b4 (patch) | |
tree | 060886dfeb4a0e5c3f7f765403dd78b81b88ce98 /src/imports/location/qdeclarativegeoboundingcircle_p.h | |
parent | d0c1282837ee8810fcf230151457159a076c0d8d (diff) | |
download | qtlocation-8dc617c3e4e4b75d8dbad3ed277056969d7d95b4.tar.gz |
Unify behaviour of BoundingBox and BoundingCircle elements.
QObject based properties of BoundingBox effectively had value sematics,
i.e. the object's properties were updated not the object pointer. Both
BoundingBox and BoundingCircle now update the object pointers.
The canonical property values are stored in the QGeoBoundingBox and
QGeoBoundingCircle data members, these are then synchronised with the
QObject based properties.
A number of optimisations have also been made. QObject based properties
are initialised on read, meaning that if a particular property is not
used it will not be constructed. Value properties (width, height,
radius) are cached so that repeated property reads do not result in
multiple nested function calls.
It is also possible to make a valid bounding box by setting its center
coordinate. The resulting bounding box will have a width and height
of 0 degrees.
Change-Id: I2569452e9a92c0b84de1b8f690655e2bed19ecb1
Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
Diffstat (limited to 'src/imports/location/qdeclarativegeoboundingcircle_p.h')
-rw-r--r-- | src/imports/location/qdeclarativegeoboundingcircle_p.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/imports/location/qdeclarativegeoboundingcircle_p.h b/src/imports/location/qdeclarativegeoboundingcircle_p.h index 60e944a1..e69b38a1 100644 --- a/src/imports/location/qdeclarativegeoboundingcircle_p.h +++ b/src/imports/location/qdeclarativegeoboundingcircle_p.h @@ -62,7 +62,7 @@ class QDeclarativeGeoBoundingCircle : public QDeclarativeGeoBoundingArea public: explicit QDeclarativeGeoBoundingCircle(QObject* parent = 0); - QDeclarativeGeoBoundingCircle(const QGeoBoundingCircle& circle, QObject* parent = 0); + explicit QDeclarativeGeoBoundingCircle(const QGeoBoundingCircle &circle, QObject *parent = 0); void setCircle(const QGeoBoundingCircle& circle); QGeoBoundingCircle circle() const; virtual QGeoBoundingArea *area() const; @@ -71,18 +71,26 @@ public: QDeclarativeCoordinate* center(); void setCenter(QDeclarativeCoordinate* coordinate); qreal radius() const; - void setRadius(const qreal radius); + void setRadius(qreal radius); signals: void centerChanged(); void radiusChanged(); +private slots: + void coordinateChanged(); + +private: + void synchronizeDeclarative(const QGeoBoundingCircle &old, bool skipCenter); + private: QDeclarativeCoordinate *m_center; - mutable QGeoBoundingCircle m_circle; + QGeoBoundingCircle m_circle; + qreal m_radius; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeGeoBoundingCircle)); + +QML_DECLARE_TYPE(QDeclarativeGeoBoundingCircle) #endif |