Commit 15ceb027 authored by Paolo Angelelli's avatar Paolo Angelelli
Browse files

Fix for copyright notice not showing before map type is changed


Task-number: QTBUG-58801
Change-Id: I2a980c6d218d0d7e44277f7b31fcdd7355e31698
Reviewed-by: default avatarAlex Blasche <alexander.blasche@qt.io>
parent ae232925
Branches
Tags v5.12.0-alpha1
No related merge requests found
Showing with 19 additions and 1 deletion
...@@ -750,10 +750,23 @@ void QDeclarativeGeoMap::mappingManagerInitialized() ...@@ -750,10 +750,23 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
// Map tiles are built in this call. m_map->minimumZoom() becomes operational // Map tiles are built in this call. m_map->minimumZoom() becomes operational
// after this has been called at least once, after creation. // 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) { 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())); m_map->setViewportSize(QSize(width(), height()));
initialize(); initialize();
QObject::disconnect(copyrightStringCatcherConnection);
QObject::disconnect(copyrightImageCatcherConnection);
} }
m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this); m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this);
...@@ -769,6 +782,11 @@ void QDeclarativeGeoMap::mappingManagerInitialized() ...@@ -769,6 +782,11 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
connect(m_map.data(), SIGNAL(copyrightsChanged(QString)), connect(m_map.data(), SIGNAL(copyrightsChanged(QString)),
this, 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)), connect(m_map.data(), SIGNAL(copyrightsStyleSheetChanged(QString)),
m_copyrights.data(), SLOT(onCopyrightsStyleSheetChanged(QString))); m_copyrights.data(), SLOT(onCopyrightsStyleSheetChanged(QString)));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment