diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2012-08-16 13:32:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-28 10:07:49 +0200 |
commit | 059388adce26be48868cd741b4c5d751298fb4d8 (patch) | |
tree | 1a8a41c0f280b7ab3c502b49527bd609d1c0884a /src/imports/location/qdeclarativegeorectangle.h | |
parent | 7dd46f8c96a4bdaca2809ff97b773f358392516f (diff) | |
download | qtlocation-57906260cc8fdff3cde3c693857a084f3ecca95e.tar.gz |
Convert GeoShape, GeoRectangle and GeoCircle into QML value types.v5.0.0-beta1
This replaces the GeoShape, GeoRectangle and GeoCircle QML elements with
value types. A value type is a better fit for shape types. It is very
similar to a rect with some utility functions.
Declare QGeoShape, QGeoRectangle and QGeoCircle as movable types.
Update documentation.
Change-Id: Id6c48e1e841c68f2f0c5c6a9c4a6580a57e2dfb6
Reviewed-by: abcd <amos.choy@nokia.com>
Diffstat (limited to 'src/imports/location/qdeclarativegeorectangle.h')
-rw-r--r-- | src/imports/location/qdeclarativegeorectangle.h | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/src/imports/location/qdeclarativegeorectangle.h b/src/imports/location/qdeclarativegeorectangle.h index edcc855e..aacd6e7c 100644 --- a/src/imports/location/qdeclarativegeorectangle.h +++ b/src/imports/location/qdeclarativegeorectangle.h @@ -43,34 +43,25 @@ #define QDECLARATIVEGEORECTANGLE_H #include "qdeclarativegeoshape.h" -#include "qdeclarativecoordinate_p.h" - -#include <QtQml/qqml.h> -#include <QtLocation/QGeoRectangle> QT_BEGIN_NAMESPACE -class QDeclarativeGeoRectangle : public QDeclarativeGeoShape +class GeoRectangleValueType : public GeoShapeValueType { Q_OBJECT - Q_PROPERTY(QGeoRectangle rectangle READ rectangle WRITE setRectangle) - Q_PROPERTY(QGeoCoordinate bottomLeft READ bottomLeft WRITE setBottomLeft NOTIFY bottomLeftChanged) - Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged) - Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged) - Q_PROPERTY(QGeoCoordinate topRight READ topRight WRITE setTopRight NOTIFY topRightChanged) - Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) - Q_PROPERTY(double height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(double width READ width WRITE setWidth NOTIFY widthChanged) + Q_PROPERTY(QGeoCoordinate bottomLeft READ bottomLeft WRITE setBottomLeft) + Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight) + Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft) + Q_PROPERTY(QGeoCoordinate topRight READ topRight WRITE setTopRight) + Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter) + Q_PROPERTY(double height READ height WRITE setHeight) + Q_PROPERTY(double width READ width WRITE setWidth) public: - explicit QDeclarativeGeoRectangle(QObject *parent = 0); - explicit QDeclarativeGeoRectangle(const QGeoRectangle &rectangle, QObject *parent = 0); - void setRectangle(const QGeoRectangle &rectangle); - QGeoRectangle rectangle() const; - QGeoShape shape() const; + explicit GeoRectangleValueType(QObject *parent = 0); + ~GeoRectangleValueType(); - Q_INVOKABLE bool contains(const QGeoCoordinate &coordinate); QGeoCoordinate bottomLeft(); void setBottomLeft(const QGeoCoordinate &coordinate); QGeoCoordinate bottomRight(); @@ -86,25 +77,13 @@ public: double width(); void setWidth(double width); -Q_SIGNALS: - void bottomLeftChanged(); - void bottomRightChanged(); - void topLeftChanged(); - void topRightChanged(); - void centerChanged(); - void heightChanged(); - void widthChanged(); - -private: - void emitChanged(const QGeoRectangle &old); - - QGeoRectangle m_box; - double m_width; - double m_height; + QString toString() const Q_DECL_OVERRIDE; + void setValue(const QVariant &value) Q_DECL_OVERRIDE; + QVariant value() Q_DECL_OVERRIDE; + void write(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags) Q_DECL_OVERRIDE; + void writeVariantValue(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, QVariant *from) Q_DECL_OVERRIDE; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QDeclarativeGeoRectangle) - #endif |