From c64d7392c2e2ae51547788252e8c83ce5480fe49 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 19 Aug 2012 03:50:04 +0200 Subject: add an arrow indicator to map watchlet --- qmapwatchlet/mapview.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'qmapwatchlet/mapview.h') diff --git a/qmapwatchlet/mapview.h b/qmapwatchlet/mapview.h index f3e457f..efd4ea5 100644 --- a/qmapwatchlet/mapview.h +++ b/qmapwatchlet/mapview.h @@ -1,16 +1,20 @@ #ifndef MAPVIEW_H #define MAPVIEW_H +#include #include #include #include +#include namespace sowatch { -using QTM_PREPEND_NAMESPACE(QGeoPositionInfo); using QTM_PREPEND_NAMESPACE(QGeoMapData); using QTM_PREPEND_NAMESPACE(QGeoPositionInfoSource); +using QTM_PREPEND_NAMESPACE(QGeoPositionInfo); +using QTM_PREPEND_NAMESPACE(QGeoBoundingBox); +using QTM_PREPEND_NAMESPACE(QGeoSearchReply); class MapView : public QDeclarativeItem { @@ -18,6 +22,7 @@ class MapView : public QDeclarativeItem Q_PROPERTY(bool updateEnabled READ updateEnabled WRITE setUpdateEnabled NOTIFY updateEnabledChanged) Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval NOTIFY updateIntervalChanged) Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged) + Q_PROPERTY(QString currentLocationName READ currentLocationName NOTIFY currentLocationNameChanged) public: explicit MapView(QDeclarativeItem *parent = 0); @@ -32,12 +37,18 @@ public: qreal zoomLevel() const; void setZoomLevel(qreal level); + QString currentLocationName() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); +public slots: + void updateCurrentLocationName(); + signals: void updateEnabledChanged(); void updateIntervalChanged(); void zoomLevelChanged(); + void currentLocationNameChanged(); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); @@ -45,11 +56,18 @@ protected: private slots: void handlePositionUpdate(const QGeoPositionInfo& info); void handleMapChanged(const QRectF& rect); + void handleCurrentLocationNameSearchFinished(); + void handleCurrentLocationNameSearchError(QGeoSearchReply::Error error, const QString& errorString); private: bool _enabled; + QImage _arrow; QGeoMapData *_mapData; - QGeoPositionInfoSource *_pos; + QGeoPositionInfoSource *_posSource; + QGeoPositionInfo _pos; + QString _posName; + QGeoBoundingBox *_searchArea; + QGeoSearchReply *_searchReply; }; } -- cgit v1.2.3