diff options
Diffstat (limited to 'platform/qt/app/mapwindow.cpp')
-rw-r--r-- | platform/qt/app/mapwindow.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index 050b498503..e29e62f157 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -258,6 +258,30 @@ void MapWindow::keyPressEvent(QKeyEvent *ev) } } break; + case Qt::Key_5: { + if (m_map->layerExists("circleLayer")) { + m_map->removeLayer("circleLayer"); + m_map->removeSource("circleSource"); + } else { + QMapbox::CoordinatesCollections geometry { { { m_map->coordinate() } } }; + QMapbox::Feature feature { QMapbox::Feature::PointType, geometry, {}, {} }; + + QVariantMap circleSource; + circleSource["type"] = "geojson"; + circleSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature); + m_map->addSource("circleSource", circleSource); + + QVariantMap circle; + circle["id"] = "circleLayer"; + circle["type"] = "circle"; + circle["source"] = "circleSource"; + m_map->addLayer(circle); + + m_map->setPaintProperty("circleLayer", "circle-radius", 10.0); + m_map->setPaintProperty("circleLayer", "circle-color", QColor("black")); + } + } + break; case Qt::Key_Tab: m_map->cycleDebugOptions(); break; |