summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-04-12 13:13:00 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-04-12 13:14:43 +0000
commit15ceb0279c46e286116a93b61f442de0105fcd0c (patch)
tree2a2b91507ff0150b2836356353a601d2097b5e97
parentae2329252e84a4931b321cacf529a13a3f06a0d5 (diff)
downloadqtlocation-15ceb0279c46e286116a93b61f442de0105fcd0c.tar.gz
Fix for copyright notice not showing before map type is changed
Task-number: QTBUG-58801 Change-Id: I2a980c6d218d0d7e44277f7b31fcdd7355e31698 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 81ef49ef..3255a0f5 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -750,10 +750,23 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
// Map tiles are built in this call. m_map->minimumZoom() becomes operational
// after this has been called at least once, after creation.
-
+ // However, getting into the following block may fire a copyrightsChanged that would get lost,
+ // as the connections are set up after.
+ QString copyrightString;
+ QImage copyrightImage;
if (!m_initialized && width() > 0 && height() > 0) {
+ QMetaObject::Connection copyrightStringCatcherConnection =
+ connect(m_map.data(),
+ QOverload<const QString &>::of(&QGeoMap::copyrightsChanged),
+ [&copyrightString](const QString &copy){ copyrightString = copy; });
+ QMetaObject::Connection copyrightImageCatcherConnection =
+ connect(m_map.data(),
+ QOverload<const QImage &>::of(&QGeoMap::copyrightsChanged),
+ [&copyrightImage](const QImage &copy){ copyrightImage = copy; });
m_map->setViewportSize(QSize(width(), height()));
initialize();
+ QObject::disconnect(copyrightStringCatcherConnection);
+ QObject::disconnect(copyrightImageCatcherConnection);
}
m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this);
@@ -769,6 +782,11 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
connect(m_map.data(), SIGNAL(copyrightsChanged(QString)),
this, SIGNAL(copyrightsChanged(QString)));
+ if (!copyrightString.isEmpty())
+ emit m_map.data()->copyrightsChanged(copyrightString);
+ else if (!copyrightImage.isNull())
+ emit m_map.data()->copyrightsChanged(copyrightImage);
+
connect(m_map.data(), SIGNAL(copyrightsStyleSheetChanged(QString)),
m_copyrights.data(), SLOT(onCopyrightsStyleSheetChanged(QString)));