summaryrefslogtreecommitdiff
path: root/platform/qt/app/mapwindow.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-07-07 19:07:35 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-07-11 17:01:32 +0300
commit462137a5360dc1d47a1cee654e43243e729befb7 (patch)
tree1a318d8dd0abbb49299adcc2868f302b1d98e943 /platform/qt/app/mapwindow.cpp
parent5ad22bd672c84328c1274f7413959642d2a92576 (diff)
downloadqtlocation-mapboxgl-462137a5360dc1d47a1cee654e43243e729befb7.tar.gz
[Qt] Bind 'L' on the example app to runtime style example1.3v81
Diffstat (limited to 'platform/qt/app/mapwindow.cpp')
-rw-r--r--platform/qt/app/mapwindow.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index da8a9767ce..bc83e2d972 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -1,7 +1,9 @@
#include "mapwindow.hpp"
#include <QApplication>
+#include <QColor>
#include <QDebug>
+#include <QFile>
#include <QIcon>
#include <QKeyEvent>
#include <QMouseEvent>
@@ -73,6 +75,33 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
case Qt::Key_S:
changeStyle();
break;
+ case Qt::Key_L: {
+ m_map.setPaintProperty("water", "fill-color", QColor(255, 0, 0));
+ m_map.setPaintProperty("building", "fill-color", "red");
+ m_map.setPaintProperty("road-secondary-tertiary", "line-color", "red");
+
+ m_map.setLayoutProperty("road-label-small", "symbol-placement", "point");
+ m_map.setLayoutProperty("road-label-medium", "symbol-placement", "point");
+ m_map.setLayoutProperty("road-label-large", "symbol-placement", "point");
+
+ QFile geojson(":source.geojson");
+ geojson.open(QIODevice::ReadOnly);
+
+ QVariantMap testSource;
+ testSource["type"] = "geojson";
+ testSource["data"] = geojson.readAll();
+
+ m_map.addSource("testSource", testSource);
+
+ QVariantMap testLayer;
+ testLayer["id"] = "testLayer";
+ testLayer["type"] = "fill";
+ testLayer["source"] = "testSource";
+
+ m_map.addLayer(testLayer);
+ m_map.setPaintProperty("testLayer", "fill-color", QColor("blue"));
+ }
+ break;
case Qt::Key_Tab:
m_map.cycleDebugOptions();
break;