summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-02-09 11:22:01 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-02-13 15:26:45 +0000
commit68520449fe15682fe8fcd666860f6ae86493ebf5 (patch)
treefb8f466f12e2bc70fffa2fc5d9ebeb07958570db
parent96508ffb32c03850033b41f1eb50e3ca9144408c (diff)
Remove dirty geo* flags from map itemsv5.9.0-alpha1
The recommended way for a plugin to get notification for when to update items is to connect to the item's signals. Therefore these introduced dirty flags that would have to be checked in a loop can be removed. Change-Id: I28c9b236b3a2e6296a89649b604381a2001a0b20 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativecirclemapitem.cpp7
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase.cpp22
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase_p.h19
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapquickitem.cpp4
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem.cpp9
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp9
-rw-r--r--src/location/declarativemaps/qdeclarativerectanglemapitem.cpp8
7 files changed, 1 insertions, 77 deletions
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
index d6a46f62..369ca986 100644
--- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
@@ -323,10 +323,6 @@ QDeclarativeCircleMapItem::QDeclarativeCircleMapItem(QQuickItem *parent)
this, SLOT(markSourceDirtyAndUpdate()));
QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
this, SLOT(markSourceDirtyAndUpdate()));
- QObject::connect(&border_, SIGNAL(colorChanged(QColor)),
- this, SLOT(markGeoMaterialDirty()));
- QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
- this, SLOT(markGeoMaterialDirty()));
// assume that circles are not self-intersecting
// to speed up processing
@@ -384,7 +380,6 @@ void QDeclarativeCircleMapItem::setCenter(const QGeoCoordinate &center)
return;
circle_.setCenter(center);
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit centerChanged(center);
}
@@ -406,7 +401,6 @@ void QDeclarativeCircleMapItem::setColor(const QColor &color)
return;
color_ = color;
dirtyMaterial_ = true;
- geoMaterialDirty_ = true;
update();
emit colorChanged(color_);
}
@@ -429,7 +423,6 @@ void QDeclarativeCircleMapItem::setRadius(qreal radius)
return;
circle_.setRadius(radius);
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit radiusChanged(radius);
}
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
index 49438a32..506c84bb 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
@@ -77,7 +77,7 @@ QGeoMapViewportChangeEvent &QGeoMapViewportChangeEvent::operator=(const QGeoMapV
}
QDeclarativeGeoMapItemBase::QDeclarativeGeoMapItemBase(QQuickItem *parent)
-: QQuickItem(parent), map_(0), quickMap_(0), geoGeometryDirty_(true), geoMaterialDirty_(true), parentGroup_(0)
+: QQuickItem(parent), map_(0), quickMap_(0), parentGroup_(0)
{
setFiltersChildMouseEvents(true);
connect(this, SIGNAL(childrenChanged()),
@@ -270,26 +270,6 @@ qreal QDeclarativeGeoMapItemBase::mapItemOpacity() const
return opacity();
}
-bool QDeclarativeGeoMapItemBase::isDirty() const
-{
- return geoGeometryDirty_ || geoMaterialDirty_;
-}
-
-bool QDeclarativeGeoMapItemBase::isGeoMaterialDirty() const
-{
- return geoMaterialDirty_;
-}
-
-bool QDeclarativeGeoMapItemBase::isGeoGeometryDirty() const
-{
- return geoGeometryDirty_;
-}
-
-void QDeclarativeGeoMapItemBase::markClean()
-{
- geoGeometryDirty_ = geoMaterialDirty_ = false;
-}
-
bool QDeclarativeGeoMapItemBase::isPolishScheduled() const
{
return QQuickItemPrivate::get(this)->polishScheduled;
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
index 3755cfa1..edb97c10 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
@@ -98,11 +98,6 @@ public:
virtual QGeoMap::ItemType itemType() const = 0;
qreal mapItemOpacity() const;
- // Data-related bool. Used by QGeoMaps that render the item directly.
- bool isDirty() const;
- bool isGeoMaterialDirty() const;
- bool isGeoGeometryDirty() const;
- void markClean();
Q_SIGNALS:
void mapItemOpacityChanged();
@@ -111,15 +106,6 @@ protected Q_SLOTS:
virtual void afterChildrenChanged();
virtual void afterViewportChanged(const QGeoMapViewportChangeEvent &event) = 0;
void polishAndUpdate();
- inline void markGeoMaterialDirty()
- {
- geoMaterialDirty_ = true;
- }
-
- inline void markGeoGeometryDirty()
- {
- geoGeometryDirty_ = true;
- }
protected:
float zoomLevelOpacity() const;
@@ -129,11 +115,6 @@ protected:
private Q_SLOTS:
void baseCameraDataChanged(const QGeoCameraData &camera);
-protected:
- // For consumption by QGeoMaps that are capable of drawing items
- bool geoGeometryDirty_;
- bool geoMaterialDirty_;
-
private:
QGeoMap *map_;
QDeclarativeGeoMap *quickMap_;
diff --git a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp
index c5c336b5..e212fa08 100644
--- a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp
@@ -149,7 +149,6 @@ void QDeclarativeGeoMapQuickItem::setCoordinate(const QGeoCoordinate &coordinate
geoshape_.setTopLeft(coordinate_);
geoshape_.setBottomRight(coordinate_);
// TODO: Handle zoomLevel != 0.0
- markGeoGeometryDirty();
polishAndUpdate();
emit coordinateChanged();
}
@@ -204,7 +203,6 @@ void QDeclarativeGeoMapQuickItem::setSourceItem(QQuickItem *sourceItem)
if (sourceItem_.data() == sourceItem)
return;
sourceItem_ = sourceItem;
- markGeoGeometryDirty(); // This is equivalent to geometry
polishAndUpdate();
emit sourceItemChanged();
}
@@ -250,7 +248,6 @@ void QDeclarativeGeoMapQuickItem::setAnchorPoint(const QPointF &anchorPoint)
if (anchorPoint == anchorPoint_)
return;
anchorPoint_ = anchorPoint;
- markGeoGeometryDirty(); // This is equivalent to geometry
polishAndUpdate();
emit anchorPointChanged();
}
@@ -283,7 +280,6 @@ void QDeclarativeGeoMapQuickItem::setZoomLevel(qreal zoomLevel)
if (zoomLevel == zoomLevel_)
return;
zoomLevel_ = zoomLevel;
- markGeoGeometryDirty(); // This is equivalent to geometry
// TODO: update geoshape_!
polishAndUpdate();
emit zoomLevelChanged();
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index 50a9fe83..ff6e58fc 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -339,10 +339,6 @@ QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent)
this, SLOT(handleBorderUpdated()));
QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
this, SLOT(handleBorderUpdated()));
- QObject::connect(&border_, SIGNAL(colorChanged(QColor)),
- this, SLOT(markGeoMaterialDirty()));
- QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
- this, SLOT(markGeoMaterialDirty()));
}
/*!
@@ -443,7 +439,6 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
borderGeometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -462,7 +457,6 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
borderGeometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -486,7 +480,6 @@ void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordina
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
borderGeometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -511,7 +504,6 @@ void QDeclarativePolygonMapItem::setColor(const QColor &color)
color_ = color;
dirtyMaterial_ = true;
- geoMaterialDirty_ = true;
update();
emit colorChanged(color_);
}
@@ -650,7 +642,6 @@ void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, cons
geopath_.translate(offsetLati, offsetLongi);
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
borderGeometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index 0c2fb0cf..cdc0175e 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -533,10 +533,6 @@ QDeclarativePolylineMapItem::QDeclarativePolylineMapItem(QQuickItem *parent)
this, SLOT(updateAfterLinePropertiesChanged()));
QObject::connect(&line_, SIGNAL(widthChanged(qreal)),
this, SLOT(updateAfterLinePropertiesChanged()));
- QObject::connect(&line_, SIGNAL(colorChanged(QColor)),
- this, SLOT(markGeoMaterialDirty()));
- QObject::connect(&line_, SIGNAL(widthChanged(qreal)),
- this, SLOT(markGeoMaterialDirty()));
}
QDeclarativePolylineMapItem::~QDeclarativePolylineMapItem()
@@ -653,7 +649,6 @@ void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate
geopath_.addCoordinate(coordinate);
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -697,7 +692,6 @@ void QDeclarativePolylineMapItem::replaceCoordinate(int index, const QGeoCoordin
geopath_.replaceCoordinate(index, coordinate);
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -747,7 +741,6 @@ void QDeclarativePolylineMapItem::removeCoordinate(const QGeoCoordinate &coordin
geopath_.removeCoordinate(coordinate);
if (geopath_.path().length() == length)
return;
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -771,7 +764,6 @@ void QDeclarativePolylineMapItem::removeCoordinate(int index)
geopath_.removeCoordinate(index);
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
}
@@ -816,7 +808,6 @@ void QDeclarativePolylineMapItem::geometryChanged(const QRectF &newGeometry, con
geopath_.translate(offsetLati, offsetLongi);
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit pathChanged();
diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
index b151d135..03f7f846 100644
--- a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
@@ -122,10 +122,6 @@ QDeclarativeRectangleMapItem::QDeclarativeRectangleMapItem(QQuickItem *parent)
this, SLOT(markSourceDirtyAndUpdate()));
QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
this, SLOT(markSourceDirtyAndUpdate()));
- QObject::connect(&border_, SIGNAL(colorChanged(QColor)),
- this, SLOT(markGeoMaterialDirty()));
- QObject::connect(&border_, SIGNAL(widthChanged(qreal)),
- this, SLOT(markGeoMaterialDirty()));
}
QDeclarativeRectangleMapItem::~QDeclarativeRectangleMapItem()
@@ -171,7 +167,6 @@ void QDeclarativeRectangleMapItem::setTopLeft(const QGeoCoordinate &topLeft)
return;
rectangle_.setTopLeft(topLeft);
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit topLeftChanged(topLeft);
}
@@ -203,7 +198,6 @@ void QDeclarativeRectangleMapItem::setBottomRight(const QGeoCoordinate &bottomRi
return;
rectangle_.setBottomRight(bottomRight);
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit bottomRightChanged(bottomRight);
}
@@ -230,7 +224,6 @@ void QDeclarativeRectangleMapItem::setColor(const QColor &color)
return;
color_ = color;
dirtyMaterial_ = true;
- geoMaterialDirty_ = true;
polishAndUpdate();
emit colorChanged(color_);
}
@@ -378,7 +371,6 @@ void QDeclarativeRectangleMapItem::geometryChanged(const QRectF &newGeometry, co
rectangle_.translate(offsetLati, offsetLongi);
geometry_.setPreserveGeometry(true, rectangle_.topLeft());
borderGeometry_.setPreserveGeometry(true, rectangle_.topLeft());
- markGeoGeometryDirty();
markSourceDirtyAndUpdate();
emit topLeftChanged(rectangle_.topLeft());
emit bottomRightChanged(rectangle_.bottomRight());