I am trying to change the appearance of the QGIS-Vertexmarker that is used when snapping is active and vertex/segment is found where you can snap to.

enter image description here

I think i found the code snippet where in the cpp files the appearance of this vertexmarker is set:

void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent * e )
  QgsMapToolAdvancedDigitizing::cadCanvasMoveEvent( e );
  bool snapped = e->isSnapped();
  QgsPoint point = e->mapPoint();

  if ( !snapped )
    delete mSnappingMarker;
    mSnappingMarker = nullptr;
    if ( !mSnappingMarker )
      mSnappingMarker = new QgsVertexMarker( mCanvas );
      mSnappingMarker->setIconType( QgsVertexMarker::ICON_CROSS );
      mSnappingMarker->setColor( Qt::magenta );
      mSnappingMarker->setPenWidth( 3 );
    mSnappingMarker->setCenter( point );


In the PyQGIS-API I haven't found an entry for the QgsMapToolCapture so I have no idea how to change the Snapping Marker using PyQGIS.

Any idea how I can change the color, size and marker-style for the SnappingMarker?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.