diff options
Diffstat (limited to 'qmapwatchlet/mapview.h')
-rw-r--r-- | qmapwatchlet/mapview.h | 22 |
1 files changed, 20 insertions, 2 deletions
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 <QtGui/QImage> #include <QtDeclarative/QDeclarativeItem> #include <QtLocation/QGeoMappingManager> #include <QtLocation/QGeoPositionInfoSource> +#include <QtLocation/QGeoSearchReply> 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; }; } |