summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-07-23 11:51:41 +0200
committerpaolo <paolo.angelelli@qt.io>2019-10-09 13:41:12 +0200
commit2bb07804f32e0c9cc7948a5cff0bcef81ae9d8c9 (patch)
tree44a8d2e4506770554d5db75395a911a43836c6ca /src/location/declarativemaps/qdeclarativegeomapitembase.cpp
parent181f1de815d2f4b32430f798da255c98dd7859ae (diff)
downloadqtlocation-2bb07804f32e0c9cc7948a5cff0bcef81ae9d8c9.tar.gz
Fix slow Map.removeMapItem
This removes connections in map items to react on map changes. A further improvement could be replacing item lists with QSets. This might however have implications with plugins which might expect ordered items. Change-Id: I52dbd64ed22762b1e2d51d1bc38f496346e7a664 Fixes: QTBUG-76950 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomapitembase.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
index 523655c0..7efc773e 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
@@ -126,21 +126,14 @@ void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *m
return;
if (quickMap && quickMap_)
return; // don't allow association to more than one map
- if (quickMap_)
- quickMap_->disconnect(this);
- if (map_)
- map_->disconnect(this);
quickMap_ = quickMap;
map_ = map;
if (map_ && quickMap_) {
- connect(map_, SIGNAL(cameraDataChanged(QGeoCameraData)),
- this, SLOT(baseCameraDataChanged(QGeoCameraData)));
- connect(map_, SIGNAL(visibleAreaChanged()),
- this, SLOT(visibleAreaChanged()));
- connect(quickMap, SIGNAL(heightChanged()), this, SLOT(polishAndUpdate()));
- connect(quickMap, SIGNAL(widthChanged()), this, SLOT(polishAndUpdate()));
+ // For performance reasons we're not connecting map_'s and quickMap_'s signals to this.
+ // Rather, the handling of cameraDataChanged, visibleAreaChanged, heightChanged and widthChanged is done explicitly in QDeclarativeGeoMap by directly calling methods on the items.
+ // See QTBUG-76950
lastSize_ = QSizeF(quickMap_->width(), quickMap_->height());
lastCameraData_ = map_->cameraData();
}