diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2014-01-29 16:45:54 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 07:09:40 +0100 |
commit | 001c842689ee5a0a91fff51a25fc6f7f9d523e51 (patch) | |
tree | b5dac249aa2894aca710049b325ad10360290296 /src/imports/location | |
parent | 202adba6230b6de21d333273eaefc44654802c9c (diff) | |
download | qtlocation-001c842689ee5a0a91fff51a25fc6f7f9d523e51.tar.gz |
Fix map item behavior when used with a MouseArea.
Update the geo coordinate properties when the map items are moved.
Change-Id: I32918571379d81c651e652513b63945ee23e3fd9
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/imports/location')
14 files changed, 143 insertions, 131 deletions
diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp index 90f34740..f26995b3 100644 --- a/src/imports/location/qdeclarativecirclemapitem.cpp +++ b/src/imports/location/qdeclarativecirclemapitem.cpp @@ -44,7 +44,10 @@ #include "qdeclarativepolygonmapitem_p.h" #include "qgeocameracapabilities_p.h" #include "qgeoprojection_p.h" + #include <cmath> + +#include <QtCore/QScopedValueRollback> #include <QPen> #include <QPainter> @@ -300,7 +303,8 @@ static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoo } QDeclarativeCircleMapItem::QDeclarativeCircleMapItem(QQuickItem *parent) -: QDeclarativeGeoMapItemBase(parent), color_(Qt::transparent), radius_(0), dirtyMaterial_(true) +: QDeclarativeGeoMapItemBase(parent), color_(Qt::transparent), radius_(0), dirtyMaterial_(true), + updatingGeometry_(false) { setFlag(ItemHasContents, true); QObject::connect(&border_, SIGNAL(colorChanged(QColor)), @@ -466,6 +470,9 @@ void QDeclarativeCircleMapItem::updateMapItem() if (!map() || !center().isValid()) return; + QScopedValueRollback<bool> rollback(updatingGeometry_); + updatingGeometry_ = true; + if (geometry_.isSourceDirty()) { circlePath_.clear(); calculatePeripheralPoints(circlePath_, center_, radius_, 125); @@ -543,37 +550,33 @@ void QDeclarativeCircleMapItem::afterViewportChanged(const QGeoMapViewportChange updateMapItem(); } - /*! \internal */ -void QDeclarativeCircleMapItem::dragStarted() +bool QDeclarativeCircleMapItem::contains(const QPointF &point) const { - geometry_.markFullScreenDirty(); - borderGeometry_.markFullScreenDirty(); - updateMapItem(); + return (geometry_.contains(point) || borderGeometry_.contains(point)); } /*! \internal */ -void QDeclarativeCircleMapItem::dragEnded() +void QDeclarativeCircleMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { + if (updatingGeometry_ || newGeometry == oldGeometry) { + QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); + return; + } + QDoubleVector2D newPoint = QDoubleVector2D(x(),y()) + QDoubleVector2D(width(), height()) / 2; QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(newPoint, false); if (newCoordinate.isValid()) setCenter(newCoordinate); -} -/*! - \internal -*/ -bool QDeclarativeCircleMapItem::contains(const QPointF &point) const -{ - return (geometry_.contains(point) || borderGeometry_.contains(point)); + // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested + // call to this function. } - bool QDeclarativeCircleMapItem::preserveCircleGeometry (QList<QGeoCoordinate> &path, const QGeoCoordinate ¢er, qreal distance, QGeoCoordinate &leftBoundCoord) diff --git a/src/imports/location/qdeclarativecirclemapitem_p.h b/src/imports/location/qdeclarativecirclemapitem_p.h index 7c899546..e09e0ea4 100644 --- a/src/imports/location/qdeclarativecirclemapitem_p.h +++ b/src/imports/location/qdeclarativecirclemapitem_p.h @@ -90,8 +90,6 @@ public: QDeclarativeMapLineProperties *border(); - void dragStarted(); - void dragEnded(); bool contains(const QPointF &point) const; Q_SIGNALS: @@ -99,6 +97,9 @@ Q_SIGNALS: void radiusChanged(qreal radius); void colorChanged(const QColor &color); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + protected Q_SLOTS: virtual void updateMapItem(); void updateMapItemAssumeDirty(); @@ -119,6 +120,7 @@ private: bool dirtyMaterial_; QGeoMapCircleGeometry geometry_; QGeoMapPolylineGeometry borderGeometry_; + bool updatingGeometry_; }; ////////////////////////////////////////////////////////////////////// diff --git a/src/imports/location/qdeclarativegeomapitembase.cpp b/src/imports/location/qdeclarativegeomapitembase.cpp index e4b56833..087d9c6a 100644 --- a/src/imports/location/qdeclarativegeomapitembase.cpp +++ b/src/imports/location/qdeclarativegeomapitembase.cpp @@ -80,9 +80,7 @@ QGeoMapViewportChangeEvent &QGeoMapViewportChangeEvent::operator=(const QGeoMapV } QDeclarativeGeoMapItemBase::QDeclarativeGeoMapItemBase(QQuickItem *parent) - : QQuickItem(parent), - map_(0), - quickMap_(0) +: QQuickItem(parent), map_(0), quickMap_(0) { setFiltersChildMouseEvents(true); connect(this, SIGNAL(childrenChanged()), @@ -122,20 +120,6 @@ void QDeclarativeGeoMapItemBase::afterChildrenChanged() /*! \internal */ -void QDeclarativeGeoMapItemBase::dragStarted() -{ -} - -/*! - \internal -*/ -void QDeclarativeGeoMapItemBase::dragEnded() -{ -} - -/*! - \internal -*/ void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) { if (quickMap == quickMap_) diff --git a/src/imports/location/qdeclarativegeomapitembase_p.h b/src/imports/location/qdeclarativegeomapitembase_p.h index 1e726459..82a8033e 100644 --- a/src/imports/location/qdeclarativegeomapitembase_p.h +++ b/src/imports/location/qdeclarativegeomapitembase_p.h @@ -75,8 +75,6 @@ public: virtual void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map); virtual void setPositionOnMap(const QGeoCoordinate &coordinate, const QPointF &offset); - virtual void dragStarted(); - virtual void dragEnded(); QDeclarativeGeoMap *quickMap() { return quickMap_; } QGeoMap *map() { return map_; } diff --git a/src/imports/location/qdeclarativegeomapquickitem.cpp b/src/imports/location/qdeclarativegeomapquickitem.cpp index dc4250d2..50f23f54 100644 --- a/src/imports/location/qdeclarativegeomapquickitem.cpp +++ b/src/imports/location/qdeclarativegeomapquickitem.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qdeclarativegeomapquickitem_p.h" + +#include <QtCore/QScopedValueRollback> #include <QtQml/qqmlinfo.h> #include <QtQuick/QSGOpacityNode> #include "qdoublevector2d_p.h" @@ -119,7 +121,7 @@ QT_BEGIN_NAMESPACE QDeclarativeGeoMapQuickItem::QDeclarativeGeoMapQuickItem(QQuickItem *parent) : QDeclarativeGeoMapItemBase(parent), zoomLevel_(0.0), inUpdate_(false), - mapAndSourceItemSet_(false) + mapAndSourceItemSet_(false), updatingGeometry_(false) { setFlag(ItemHasContents, true); opacityContainer_ = new QQuickItem(this); @@ -171,13 +173,20 @@ void QDeclarativeGeoMapQuickItem::setMap(QDeclarativeGeoMap *quickMap, QGeoMap * /*! \internal */ -void QDeclarativeGeoMapQuickItem::dragEnded() +void QDeclarativeGeoMapQuickItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if (!mapAndSourceItemSet_) + if (!mapAndSourceItemSet_ || updatingGeometry_ || + newGeometry.topLeft() == oldGeometry.topLeft()) { + QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); return; + } + QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(QDoubleVector2D(x(), y()) + (scaleFactor() * QDoubleVector2D(anchorPoint_)), false); if (newCoordinate.isValid()) setCoordinate(newCoordinate); + + // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested + // call to this function. } /*! @@ -316,6 +325,9 @@ void QDeclarativeGeoMapQuickItem::updateMapItem() this, SLOT(updateMapItem())); } + QScopedValueRollback<bool> rollback(updatingGeometry_); + updatingGeometry_ = true; + opacityContainer_->setOpacity(zoomLevelOpacity()); sourceItem_.data()->setScale(scaleFactor()); diff --git a/src/imports/location/qdeclarativegeomapquickitem_p.h b/src/imports/location/qdeclarativegeomapquickitem_p.h index 1ed658d9..b9510b37 100644 --- a/src/imports/location/qdeclarativegeomapquickitem_p.h +++ b/src/imports/location/qdeclarativegeomapquickitem_p.h @@ -76,14 +76,15 @@ public: void setZoomLevel(qreal zoomLevel); qreal zoomLevel() const; - void dragEnded(); - Q_SIGNALS: void coordinateChanged(); void sourceItemChanged(); void anchorPointChanged(); void zoomLevelChanged(); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + protected Q_SLOTS: virtual void updateMapItem(); virtual void afterChildrenChanged(); @@ -98,6 +99,7 @@ private: qreal zoomLevel_; bool inUpdate_; bool mapAndSourceItemSet_; + bool updatingGeometry_; }; QT_END_NAMESPACE diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 442ad307..59fc21bf 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -45,6 +45,7 @@ #include "error_messages.h" #include "locationvaluetypehelper_p.h" +#include <QtCore/QScopedValueRollback> #include <QtGui/private/qtriangulator_p.h> #include <QtQml/QQmlInfo> #include <QtQml/QQmlContext> @@ -320,10 +321,9 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map) } -QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent) : - QDeclarativeGeoMapItemBase(parent), - color_(Qt::transparent), - dirtyMaterial_(true) +QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent) +: QDeclarativeGeoMapItemBase(parent), color_(Qt::transparent), dirtyMaterial_(true), + updatingGeometry_(false) { setFlag(ItemHasContents, true); QObject::connect(&border_, SIGNAL(colorChanged(QColor)), @@ -540,6 +540,9 @@ void QDeclarativePolygonMapItem::updateMapItem() if (!map() || path_.count() == 0) return; + QScopedValueRollback<bool> rollback(updatingGeometry_); + updatingGeometry_ = true; + geometry_.updateSourcePoints(*map(), path_); geometry_.updateScreenPoints(*map()); @@ -611,18 +614,13 @@ bool QDeclarativePolygonMapItem::contains(const QPointF &point) const /*! \internal */ -void QDeclarativePolygonMapItem::dragStarted() +void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - geometry_.markFullScreenDirty(); - borderGeometry_.markFullScreenDirty(); - updateMapItem(); -} + if (updatingGeometry_ || newGeometry.topLeft() == oldGeometry.topLeft()) { + QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); + return; + } -/*! - \internal -*/ -void QDeclarativePolygonMapItem::dragEnded() -{ QDoubleVector2D newPoint = QDoubleVector2D(x(),y()) + QDoubleVector2D(geometry_.firstPointOffset()); QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(newPoint, false); if (newCoordinate.isValid()) { @@ -662,6 +660,9 @@ void QDeclarativePolygonMapItem::dragEnded() updateMapItem(); emit pathChanged(); } + + // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested + // call to this function. } ////////////////////////////////////////////////////////////////////// diff --git a/src/imports/location/qdeclarativepolygonmapitem_p.h b/src/imports/location/qdeclarativepolygonmapitem_p.h index d95e1de3..e96dd2cf 100644 --- a/src/imports/location/qdeclarativepolygonmapitem_p.h +++ b/src/imports/location/qdeclarativepolygonmapitem_p.h @@ -101,13 +101,14 @@ public: QDeclarativeMapLineProperties *border(); bool contains(const QPointF &point) const; - void dragStarted(); - void dragEnded(); Q_SIGNALS: void pathChanged(); void colorChanged(const QColor &color); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + protected Q_SLOTS: virtual void updateMapItem(); void handleBorderUpdated(); @@ -122,6 +123,7 @@ private: bool dirtyMaterial_; QGeoMapPolygonGeometry geometry_; QGeoMapPolylineGeometry borderGeometry_; + bool updatingGeometry_; }; ////////////////////////////////////////////////////////////////////// diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index 1cc51271..373b101b 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -46,6 +46,7 @@ #include "locationvaluetypehelper_p.h" #include "qdoublevector2d_p.h" +#include <QtCore/QScopedValueRollback> #include <QtQml/QQmlInfo> #include <QtQml/QQmlContext> #include <QtQml/private/qqmlengine_p.h> @@ -449,9 +450,8 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map, this->translate( -1 * sourceBounds_.topLeft()); } -QDeclarativePolylineMapItem::QDeclarativePolylineMapItem(QQuickItem *parent) : - QDeclarativeGeoMapItemBase(parent), - dirtyMaterial_(true) +QDeclarativePolylineMapItem::QDeclarativePolylineMapItem(QQuickItem *parent) +: QDeclarativeGeoMapItemBase(parent), dirtyMaterial_(true), updatingGeometry_(false) { setFlag(ItemHasContents, true); QObject::connect(&line_, SIGNAL(colorChanged(QColor)), @@ -611,6 +611,57 @@ QDeclarativeMapLineProperties *QDeclarativePolylineMapItem::line() /*! \internal */ +void QDeclarativePolylineMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + if (updatingGeometry_ || newGeometry.topLeft() == oldGeometry.topLeft()) { + QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); + return; + } + + QDoubleVector2D newPoint = QDoubleVector2D(x(),y()) + QDoubleVector2D(geometry_.firstPointOffset()); + QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(newPoint, false); + if (newCoordinate.isValid()) { + double firstLongitude = path_.at(0).longitude(); + double firstLatitude = path_.at(0).latitude(); + double minMaxLatitude = firstLatitude; + // prevent dragging over valid min and max latitudes + for (int i = 0; i < path_.count(); ++i) { + double newLatitude = path_.at(i).latitude() + + newCoordinate.latitude() - firstLatitude; + if (!QLocationUtils::isValidLat(newLatitude)) { + if (qAbs(newLatitude) > qAbs(minMaxLatitude)) { + minMaxLatitude = newLatitude; + } + } + } + // calculate offset needed to re-position the item within map border + double offsetLatitude = minMaxLatitude - QLocationUtils::clipLat(minMaxLatitude); + for (int i = 0; i < path_.count(); ++i) { + QGeoCoordinate coord = path_.at(i); + // handle dateline crossing + coord.setLongitude(QLocationUtils::wrapLong(coord.longitude() + + newCoordinate.longitude() - firstLongitude)); + coord.setLatitude(coord.latitude() + + newCoordinate.latitude() - firstLatitude - offsetLatitude); + path_.replace(i, coord); + } + + QGeoCoordinate leftBoundCoord = geometry_.geoLeftBound(); + leftBoundCoord.setLongitude(QLocationUtils::wrapLong(leftBoundCoord.longitude() + + newCoordinate.longitude() - firstLongitude)); + geometry_.setPreserveGeometry(true, leftBoundCoord); + geometry_.markSourceDirty(); + updateMapItem(); + emit pathChanged(); + } + + // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested + // call to this function. +} + +/*! + \internal +*/ void QDeclarativePolylineMapItem::afterViewportChanged(const QGeoMapViewportChangeEvent &event) { if (event.mapSize.width() <= 0 || event.mapSize.height() <= 0) @@ -647,6 +698,9 @@ void QDeclarativePolylineMapItem::updateMapItem() if (!map() || path_.count() == 0) return; + QScopedValueRollback<bool> rollback(updatingGeometry_); + updatingGeometry_ = true; + geometry_.updateSourcePoints(*map(), path_); geometry_.updateScreenPoints(*map(), line_.width()); @@ -684,58 +738,6 @@ bool QDeclarativePolylineMapItem::contains(const QPointF &point) const return geometry_.contains(point); } -/*! - \internal -*/ -void QDeclarativePolylineMapItem::dragStarted() -{ - geometry_.markFullScreenDirty(); - updateMapItem(); -} - -/*! - \internal -*/ -void QDeclarativePolylineMapItem::dragEnded() -{ - QDoubleVector2D newPoint = QDoubleVector2D(x(),y()) + QDoubleVector2D(geometry_.firstPointOffset()); - QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(newPoint, false); - if (newCoordinate.isValid()) { - double firstLongitude = path_.at(0).longitude(); - double firstLatitude = path_.at(0).latitude(); - double minMaxLatitude = firstLatitude; - // prevent dragging over valid min and max latitudes - for (int i = 0; i < path_.count(); ++i) { - double newLatitude = path_.at(i).latitude() - + newCoordinate.latitude() - firstLatitude; - if (!QLocationUtils::isValidLat(newLatitude)) { - if (qAbs(newLatitude) > qAbs(minMaxLatitude)) { - minMaxLatitude = newLatitude; - } - } - } - // calculate offset needed to re-position the item within map border - double offsetLatitude = minMaxLatitude - QLocationUtils::clipLat(minMaxLatitude); - for (int i = 0; i < path_.count(); ++i) { - QGeoCoordinate coord = path_.at(i); - // handle dateline crossing - coord.setLongitude(QLocationUtils::wrapLong(coord.longitude() - + newCoordinate.longitude() - firstLongitude)); - coord.setLatitude(coord.latitude() - + newCoordinate.latitude() - firstLatitude - offsetLatitude); - path_.replace(i, coord); - } - - QGeoCoordinate leftBoundCoord = geometry_.geoLeftBound(); - leftBoundCoord.setLongitude(QLocationUtils::wrapLong(leftBoundCoord.longitude() - + newCoordinate.longitude() - firstLongitude)); - geometry_.setPreserveGeometry(true, leftBoundCoord); - geometry_.markSourceDirty(); - updateMapItem(); - emit pathChanged(); - } -} - ////////////////////////////////////////////////////////////////////// /*! diff --git a/src/imports/location/qdeclarativepolylinemapitem_p.h b/src/imports/location/qdeclarativepolylinemapitem_p.h index c6e5740d..18f85b09 100644 --- a/src/imports/location/qdeclarativepolylinemapitem_p.h +++ b/src/imports/location/qdeclarativepolylinemapitem_p.h @@ -124,12 +124,12 @@ public: QDeclarativeMapLineProperties *line(); - void dragStarted(); - void dragEnded(); - Q_SIGNALS: void pathChanged(); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + protected Q_SLOTS: virtual void updateMapItem(); void updateAfterLinePropertiesChanged(); @@ -143,6 +143,7 @@ private: QColor color_; bool dirtyMaterial_; QGeoMapPolylineGeometry geometry_; + bool updatingGeometry_; }; ////////////////////////////////////////////////////////////////////// diff --git a/src/imports/location/qdeclarativerectanglemapitem.cpp b/src/imports/location/qdeclarativerectanglemapitem.cpp index 683f6dbf..54514ea5 100644 --- a/src/imports/location/qdeclarativerectanglemapitem.cpp +++ b/src/imports/location/qdeclarativerectanglemapitem.cpp @@ -47,6 +47,7 @@ #include <qnumeric.h> #include <QRectF> #include <QPointF> +#include <QtCore/QScopedValueRollback> QT_BEGIN_NAMESPACE @@ -177,7 +178,8 @@ void QGeoMapRectangleGeometry::updatePoints(const QGeoMap &map, } QDeclarativeRectangleMapItem::QDeclarativeRectangleMapItem(QQuickItem *parent) -: QDeclarativeGeoMapItemBase(parent), color_(Qt::transparent), dirtyMaterial_(true) +: QDeclarativeGeoMapItemBase(parent), color_(Qt::transparent), dirtyMaterial_(true), + updatingGeometry_(false) { setFlag(ItemHasContents, true); QObject::connect(&border_, SIGNAL(colorChanged(QColor)), @@ -342,6 +344,9 @@ void QDeclarativeRectangleMapItem::updateMapItem() if (!map() || !topLeft().isValid() || !bottomRight().isValid()) return; + QScopedValueRollback<bool> rollback(updatingGeometry_); + updatingGeometry_ = true; + geometry_.updatePoints(*map(), topLeft_, bottomRight_); QList<QGeoCoordinate> pathClosed; @@ -419,17 +424,13 @@ bool QDeclarativeRectangleMapItem::contains(const QPointF &point) const /*! \internal */ -void QDeclarativeRectangleMapItem::dragStarted() +void QDeclarativeRectangleMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - borderGeometry_.markFullScreenDirty(); - updateMapItem(); -} + if (updatingGeometry_ || newGeometry.topLeft() == oldGeometry.topLeft()) { + QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); + return; + } -/*! - \internal -*/ -void QDeclarativeRectangleMapItem::dragEnded() -{ QDoubleVector2D newTopLeftPoint = QDoubleVector2D(x(),y()); QGeoCoordinate newTopLeft = map()->screenPositionToCoordinate(newTopLeftPoint, false); if (newTopLeft.isValid()) { @@ -459,6 +460,9 @@ void QDeclarativeRectangleMapItem::dragEnded() emit topLeftChanged(topLeft_); emit bottomRightChanged(bottomRight_); } + + // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested + // call to this function. } QT_END_NAMESPACE diff --git a/src/imports/location/qdeclarativerectanglemapitem_p.h b/src/imports/location/qdeclarativerectanglemapitem_p.h index 71915d5b..ead79f59 100644 --- a/src/imports/location/qdeclarativerectanglemapitem_p.h +++ b/src/imports/location/qdeclarativerectanglemapitem_p.h @@ -92,8 +92,6 @@ public: QDeclarativeMapLineProperties *border(); - void dragStarted(); - void dragEnded(); bool contains(const QPointF &point) const; Q_SIGNALS: @@ -101,6 +99,9 @@ Q_SIGNALS: void bottomRightChanged(const QGeoCoordinate &bottomRight); void colorChanged(const QColor &color); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + protected Q_SLOTS: virtual void updateMapItem(); void updateMapItemAssumeDirty(); @@ -114,6 +115,7 @@ private: bool dirtyMaterial_; QGeoMapRectangleGeometry geometry_; QGeoMapPolylineGeometry borderGeometry_; + bool updatingGeometry_; }; ////////////////////////////////////////////////////////////////////// diff --git a/src/imports/location/qdeclarativeroutemapitem.cpp b/src/imports/location/qdeclarativeroutemapitem.cpp index f084dbb8..4f2ee546 100644 --- a/src/imports/location/qdeclarativeroutemapitem.cpp +++ b/src/imports/location/qdeclarativeroutemapitem.cpp @@ -44,6 +44,7 @@ #include "qdeclarativepolylinemapitem_p.h" #include "qgeocameracapabilities_p.h" #include "qdeclarativegeoroute_p.h" + #include <QtQml/QQmlInfo> #include <QtGui/QPainter> @@ -81,9 +82,8 @@ */ -QDeclarativeRouteMapItem::QDeclarativeRouteMapItem(QQuickItem *parent): - QDeclarativeGeoMapItemBase(parent), - route_(0) +QDeclarativeRouteMapItem::QDeclarativeRouteMapItem(QQuickItem *parent) +: QDeclarativeGeoMapItemBase(parent), route_(0) { setFlag(ItemHasContents, true); line_.setWidth(3.0); diff --git a/src/imports/location/qdeclarativeroutemapitem_p.h b/src/imports/location/qdeclarativeroutemapitem_p.h index 479a621d..f80e896d 100644 --- a/src/imports/location/qdeclarativeroutemapitem_p.h +++ b/src/imports/location/qdeclarativeroutemapitem_p.h @@ -87,7 +87,6 @@ private: QDeclarativeGeoRoute *route_; QList<QGeoCoordinate> path_; bool dirtyMaterial_; - bool dragActive_; QGeoMapPolylineGeometry geometry_; }; |