Skip to content
Permalink
Browse files
Newly created point text items should default to using a symbology
reference scale at the current map canvas scale

This means that a user can drop some text directly onto the map
as an annotation, and it will be set to say 16 points font size
at the current scale. Zooming in/out of the map will scale the text
up and down, so it will always retain its relative geographic size.

(Of course, users can manually uncheck the reference scale option
if they prefer to have a fixed font size independent of the map scale)
  • Loading branch information
nyalldawson committed Sep 8, 2021
1 parent 7a971bb commit 127ef22e0f4f92520d4f6663f9ca9953190507fc
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/gui/annotations/qgscreateannotationitemmaptool_impl.cpp
@@ -18,6 +18,7 @@
#include "qgsannotationpointtextitem.h"
#include "qgsannotationlayer.h"
#include "qgsstyle.h"
#include "qgsmapcanvas.h"

///@cond PRIVATE

@@ -39,6 +40,9 @@ void QgsCreatePointTextItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event
mCreatedItem = std::make_unique< QgsAnnotationPointTextItem >( tr( "Text" ), layerPoint );
mCreatedItem->setAlignment( Qt::AlignLeft );
mCreatedItem->setFormat( QgsStyle::defaultStyle()->defaultTextFormat( QgsStyle::TextFormatContext::Labeling ) );
// newly created point text items default to using symbology reference scale at the current map scale
mCreatedItem->setUseSymbologyReferenceScale( true );
mCreatedItem->setSymbologyReferenceScale( canvas()->scale() );
emit itemCreated();
}

0 comments on commit 127ef22

Please sign in to comment.