summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-02-10 17:18:33 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-02-21 12:33:10 +0000
commit9daf00ef519e3dbd061e64bfe13b2ca9bfab4e28 (patch)
tree68977f7bcf802bc59f05d9a693fabf1d96d9ac14
parent144b206099a198868ab955e3b89dcfb200deb3cb (diff)
downloadqtlocation-9daf00ef519e3dbd061e64bfe13b2ca9bfab4e28.tar.gz
Assign QGeoMapObjectPrivate::m_map after creating the new implementation
Or else it will be null, as no copy constructor for QGeoMapPrivate is defined (and used). Change-Id: I6045ccd4ec15c775a6ae0f9c55107103dfe28e9e Reviewed-by: BogDan Vatra <bogdan@kdab.com>
-rw-r--r--src/location/declarativemaps/qgeomapobject.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qgeomapobject.cpp b/src/location/declarativemaps/qgeomapobject.cpp
index 9d94900f..2e81afa9 100644
--- a/src/location/declarativemaps/qgeomapobject.cpp
+++ b/src/location/declarativemaps/qgeomapobject.cpp
@@ -176,16 +176,28 @@ void QGeoMapObject::setMap(QGeoMap *map)
if (d_ptr->m_map == map)
return;
- d_ptr->m_map = map;
if (map) {
+ bool oldVisible = d_ptr->m_visible;
+ bool oldCmponentCompleted = d_ptr->m_componentCompleted;
if (!map->createMapObjectImplementation(this))
qWarning() << "Unsupported type " << type();
// old implementation gets destroyed if/when d_ptr gets replaced
+ d_ptr->m_componentCompleted = oldCmponentCompleted;
+ d_ptr->setVisible(oldVisible);
}
+ d_ptr->m_map = map;
const QList<QGeoMapObject *> kids = geoMapObjectChildren();
for (auto kid : kids)
kid->setMap(map);
+
+ // Each subclass is in charge to do the equivalent of
+ // if (!map) {
+ // // Map was set, now it has ben re-set to NULL
+ // d_ptr = new QMapCircleObjectPrivateDefault(*d);
+ // // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ // }
+ // After this method is called.
}
QGeoMap *QGeoMapObject::map() const