From 9bea2007a0556e4fc0606b31d0438bf44a44e7d5 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Thu, 11 May 2017 18:35:56 +0300 Subject: [Qt] Add example of adding a layer before other layer --- platform/qt/app/mapwindow.cpp | 7 +++++-- 1 file 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); -- cgit v1.2.1