summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2017-05-11 18:35:56 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-05-11 20:28:18 +0300
commit9bea2007a0556e4fc0606b31d0438bf44a44e7d5 (patch)
tree542c95bf1b4881cc0e66e098fa63820a478a1a3b
parentc307273dae23751f1c2c621804a6c54761665348 (diff)
downloadqtlocation-mapboxgl-9bea2007a0556e4fc0606b31d0438bf44a44e7d5.tar.gz
[Qt] Add example of adding a layer before other layer
-rw-r--r--platform/qt/app/mapwindow.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index 5bb9ad1261..aa5561731c 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -92,6 +92,9 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
m_sourceAdded = true;
+ // Not in all styles, but will work on streets
+ QString before = "waterway-label";
+
QFile geojson(":source1.geojson");
geojson.open(QIODevice::ReadOnly);
@@ -106,7 +109,7 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
routeCase["id"] = "routeCase";
routeCase["type"] = "line";
routeCase["source"] = "routeSource";
- m_map->addLayer(routeCase);
+ m_map->addLayer(routeCase, before);
m_map->setPaintProperty("routeCase", "line-color", QColor("white"));
m_map->setPaintProperty("routeCase", "line-width", 20.0);
@@ -118,7 +121,7 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
route["id"] = "route";
route["type"] = "line";
route["source"] = "routeSource";
- m_map->addLayer(route);
+ m_map->addLayer(route, before);
m_map->setPaintProperty("route", "line-color", QColor("blue"));
m_map->setPaintProperty("route", "line-width", 8.0);