diff --git a/res/logo.png b/res/logo.png
new file mode 100644
index 0000000..9d6e90e
Binary files /dev/null and b/res/logo.png differ
diff --git a/res/mapbox.qrc b/res/mapbox.qrc
new file mode 100644
index 0000000..51fb414
--- /dev/null
+++ b/res/mapbox.qrc
@@ -0,0 +1,5 @@
+
+
+ logo.png
+
+
diff --git a/src/GeoTiledMappingManagerEngine.cpp b/src/GeoTiledMappingManagerEngine.cpp
index 7a86db1..f773c95 100644
--- a/src/GeoTiledMappingManagerEngine.cpp
+++ b/src/GeoTiledMappingManagerEngine.cpp
@@ -168,10 +168,33 @@ GeoTiledMappingManagerEngine::GeoTiledMappingManagerEngine(const QVariantMap& pa
QGeoMap* GeoTiledMappingManagerEngine::createMap()
{
- return m_noMapTiles ? new NoGeoTiledMap(this, 0) : new QGeoTiledMap(this, 0);
+ return m_noMapTiles ? new NoGeoTiledMap(this, 0) : new CustomGeoTiledMap(this, 0);
}
QSGNode* NoGeoTiledMap::updateSceneGraph(QSGNode*, QQuickWindow*)
{
return nullptr;
}
+
+CustomGeoTiledMap::CustomGeoTiledMap(GeoTiledMappingManagerEngine *engine, QObject *parent) :
+ QGeoTiledMap(engine, parent) {
+ setCopyrightVisible(true);
+}
+
+QString CustomGeoTiledMap::copyrightsStyleSheet() const
+{
+ return QStringLiteral("* { vertical-align: middle; font-weight: normal }");
+}
+
+void CustomGeoTiledMap::evaluateCopyrights(const QSet &visibleTiles) {
+ Q_UNUSED(visibleTiles);
+
+ QString copyrightsHtmlFinal("© Mapbox "
+ "© OpenStreetMap "
+ "Improve this map");
+
+ copyrightsHtmlFinal = " | "
+ + copyrightsHtmlFinal + " |
---|
";
+
+ emit copyrightsChanged(copyrightsHtmlFinal);
+}
diff --git a/src/GeoTiledMappingManagerEngine.h b/src/GeoTiledMappingManagerEngine.h
index ef294c2..d2dc568 100644
--- a/src/GeoTiledMappingManagerEngine.h
+++ b/src/GeoTiledMappingManagerEngine.h
@@ -11,6 +11,14 @@ class NoGeoTiledMap : public QGeoTiledMap
QSGNode* updateSceneGraph(QSGNode*, QQuickWindow* window) override;
};
+class CustomGeoTiledMap: public QGeoTiledMap {
+public:
+ CustomGeoTiledMap(GeoTiledMappingManagerEngine *engine, QObject *parent);
+ virtual ~CustomGeoTiledMap() = default;
+ QString copyrightsStyleSheet() const override;
+ virtual void evaluateCopyrights(const QSet &visibleTiles) override;
+};
+
class GeoTiledMappingManagerEngine : public QGeoTiledMappingManagerEngine
{
Q_OBJECT
diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt
index 5624073..7741a0f 100644
--- a/test_package/CMakeLists.txt
+++ b/test_package/CMakeLists.txt
@@ -17,7 +17,9 @@ find_package(Qt5 COMPONENTS
REQUIRED QUIET)
find_package(QtBasemapPlugin REQUIRED QUIET)
-add_executable(example example.cpp)
+qt5_add_resources(IMAGES_RCC "res/mapbox.qrc")
+
+add_executable(example example.cpp ${IMAGES_RCC})
get_property(MAP_PLUGIN TARGET qtgeoservices_basemap_pix4d PROPERTY IMPORTED_LOCATION_RELEASE)
message(STATUS "Map plugin path ${MAP_PLUGIN}")