QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
qgscreateannotationitemmaptool_impl.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscreateannotationitemmaptool_impl.cpp
3 ------------------------
4 Date : September 2021
5 Copyright : (C) 2021 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17#include "qgsmapmouseevent.h"
25#include "qgsannotationlayer.h"
26#include "qgsstyle.h"
27#include "qgsmapcanvas.h"
28#include "qgsmarkersymbol.h"
29#include "qgslinesymbol.h"
30#include "qgsfillsymbol.h"
32#include "qgsapplication.h"
34#include "qgscurvepolygon.h"
35#include "qgsrubberband.h"
37#include "qgssvgcache.h"
38#include "qgsimagecache.h"
39
40#include <QFileDialog>
41#include <QImageReader>
42
44
45//
46// QgsMapToolCaptureAnnotationItem
47//
48
49QgsMapToolCaptureAnnotationItem::QgsMapToolCaptureAnnotationItem( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode )
50 : QgsMapToolCapture( canvas, cadDockWidget, mode )
51{
52 mToolName = tr( "Annotation tool" );
53}
54
55QgsCreateAnnotationItemMapToolHandler *QgsMapToolCaptureAnnotationItem::handler()
56{
57 return mHandler;
58}
59
60QgsMapTool *QgsMapToolCaptureAnnotationItem::mapTool()
61{
62 return this;
63}
64
65QgsMapLayer *QgsMapToolCaptureAnnotationItem::layer() const
66{
67 return mHandler->targetLayer();
68}
69
70
71QgsMapToolCapture::Capabilities QgsMapToolCaptureAnnotationItem::capabilities() const
72{
73 // no geometry validation!
74 return SupportsCurves;
75}
76
77bool QgsMapToolCaptureAnnotationItem::supportsTechnique( Qgis::CaptureTechnique technique ) const
78{
79 switch ( technique )
80 {
85 return true;
86 }
88}
89
90
91//
92// QgsCreatePointTextItemMapTool
93//
94
95QgsCreatePointTextItemMapTool::QgsCreatePointTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
96 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
97 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget ) )
98{
99 setUseSnappingIndicator( true );
100}
101
102QgsCreatePointTextItemMapTool::~QgsCreatePointTextItemMapTool() = default;
103
104void QgsCreatePointTextItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event )
105{
106 if ( event->button() != Qt::LeftButton )
107 return;
108
109 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
110
111 std::unique_ptr< QgsAnnotationPointTextItem > createdItem = std::make_unique< QgsAnnotationPointTextItem >( tr( "Text" ), layerPoint );
112 createdItem->setAlignment( Qt::AlignLeft );
114 // default to HTML formatting
115 format.setAllowHtmlFormatting( true );
116 createdItem->setFormat( format );
117 // newly created point text items default to using symbology reference scale at the current map scale
118 createdItem->setUseSymbologyReferenceScale( true );
119 createdItem->setSymbologyReferenceScale( canvas()->scale() );
120 mHandler->pushCreatedItem( createdItem.release() );
121}
122
123QgsCreateAnnotationItemMapToolHandler *QgsCreatePointTextItemMapTool::handler()
124{
125 return mHandler;
126}
127
128QgsMapTool *QgsCreatePointTextItemMapTool::mapTool()
129{
130 return this;
131}
132
133
134
135//
136// QgsCreateMarkerMapTool
137//
138
139QgsCreateMarkerItemMapTool::QgsCreateMarkerItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
140 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePoint )
141{
142 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
143}
144
145void QgsCreateMarkerItemMapTool::cadCanvasReleaseEvent( QgsMapMouseEvent *event )
146{
147 if ( event->button() != Qt::LeftButton )
148 return;
149
150 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
151 std::unique_ptr< QgsAnnotationMarkerItem > createdItem = std::make_unique< QgsAnnotationMarkerItem >( QgsPoint( layerPoint ) );
152
153 std::unique_ptr< QgsMarkerSymbol > markerSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsMarkerSymbol >( QStringLiteral( "marker_annotation_item" ) );
154 if ( !markerSymbol )
155 markerSymbol.reset( qgis::down_cast< QgsMarkerSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) );
156 createdItem->setSymbol( markerSymbol.release() );
157
158 // set reference scale to match canvas scale, but don't enable it by default for marker items
159 createdItem->setSymbologyReferenceScale( canvas()->scale() );
160
161 mHandler->pushCreatedItem( createdItem.release() );
162
163 stopCapturing();
164
165 cadDockWidget()->clearPoints();
166}
167
168//
169// QgsCreateLineMapTool
170//
171
172QgsCreateLineItemMapTool::QgsCreateLineItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
173 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
174{
175 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
176}
177
178void QgsCreateLineItemMapTool::lineCaptured( const QgsCurve *line )
179{
180 if ( line->isEmpty() )
181 return;
182
183 // do it!
184 std::unique_ptr< QgsAbstractGeometry > geometry( line->simplifiedTypeRef()->clone() );
185 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
186 {
187 std::unique_ptr< QgsAnnotationLineItem > createdItem = std::make_unique< QgsAnnotationLineItem >( qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
188
189 std::unique_ptr< QgsLineSymbol > lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsLineSymbol >( QStringLiteral( "line_annotation_item" ) );
190 if ( !lineSymbol )
191 lineSymbol.reset( qgis::down_cast< QgsLineSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
192 createdItem->setSymbol( lineSymbol.release() );
193
194 // set reference scale to match canvas scale, but don't enable it by default for marker items
195 createdItem->setSymbologyReferenceScale( canvas()->scale() );
196
197 mHandler->pushCreatedItem( createdItem.release() );
198 }
199}
200
201//
202// QgsCreatePolygonItemMapTool
203//
204
205QgsCreatePolygonItemMapTool::QgsCreatePolygonItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
206 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePolygon )
207{
208 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
209}
210
211void QgsCreatePolygonItemMapTool::polygonCaptured( const QgsCurvePolygon *polygon )
212{
213 if ( polygon->isEmpty() )
214 return;
215
216 std::unique_ptr< QgsAbstractGeometry > geometry( polygon->exteriorRing()->simplifiedTypeRef()->clone() );
217 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
218 {
219 std::unique_ptr< QgsCurvePolygon > newPolygon = std::make_unique< QgsCurvePolygon >();
220 newPolygon->setExteriorRing( qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
221 std::unique_ptr< QgsAnnotationPolygonItem > createdItem = std::make_unique< QgsAnnotationPolygonItem >( newPolygon.release() );
222
223 std::unique_ptr< QgsFillSymbol > fillSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsFillSymbol >( QStringLiteral( "polygon_annotation_item" ) );
224 if ( !fillSymbol )
225 fillSymbol.reset( qgis::down_cast< QgsFillSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ) );
226 createdItem->setSymbol( fillSymbol.release() );
227
228 // set reference scale to match canvas scale, but don't enable it by default for marker items
229 createdItem->setSymbologyReferenceScale( canvas()->scale() );
230
231 mHandler->pushCreatedItem( createdItem.release() );
232 }
233}
234
235
236//
237// QgsCreatePictureItemMapTool
238//
239
240const QgsSettingsEntryString *QgsCreatePictureItemMapTool::settingLastSourceFolder = new QgsSettingsEntryString( QStringLiteral( "last-source-folder" ), sTreePicture, QString(), QStringLiteral( "Last used folder for picture annotation source files" ) );
241
242QgsCreatePictureItemMapTool::QgsCreatePictureItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
243 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
244 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
245{
246 setUseSnappingIndicator( true );
247}
248
249void QgsCreatePictureItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event )
250{
251 if ( event->button() == Qt::RightButton && mRubberBand )
252 {
253 mRubberBand.reset();
254 cadDockWidget()->clearPoints();
255 return;
256 }
257
258 if ( event->button() != Qt::LeftButton )
259 return;
260
261 if ( !mRubberBand )
262 {
263 mFirstPoint = event->snapPoint();
264 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
265
266 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
267 mRubberBand->setWidth( digitizingStrokeWidth() );
268 QColor color = digitizingStrokeColor();
269
271 color.setAlphaF( color.alphaF() * alphaScale );
272 mRubberBand->setLineStyle( Qt::DotLine );
273 mRubberBand->setStrokeColor( color );
274
275 const QColor fillColor = digitizingFillColor();
276 mRubberBand->setFillColor( fillColor );
277 }
278 else
279 {
280 mRubberBand.reset();
281
282 QStringList formatsFilter;
283 formatsFilter.append( QStringLiteral( "*.svg" ) );
284 const QByteArrayList supportedFormats = QImageReader::supportedImageFormats();
285 for ( const auto &format : supportedFormats )
286 {
287 formatsFilter.append( QString( QStringLiteral( "*.%1" ) ).arg( QString( format ) ) );
288 }
289 const QString dialogFilter = QStringLiteral( "%1 (%2);;%3 (*.*)" ).arg( tr( "Images" ), formatsFilter.join( QLatin1Char( ' ' ) ), tr( "All files" ) );
290 const QString initialDir = settingLastSourceFolder->value();
291 const QString imagePath = QFileDialog::getOpenFileName( nullptr, tr( "Add Picture Annotation" ), initialDir.isEmpty() ? QDir::homePath() : initialDir, dialogFilter );
292
293 if ( imagePath.isEmpty() )
294 {
295 return; //canceled by the user
296 }
297
298 settingLastSourceFolder->setValue( QFileInfo( imagePath ).path() );
299
300 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
301 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
302
303 const QgsPointXY devicePoint1 = toCanvasCoordinates( mFirstPoint );
304 const QgsPointXY devicePoint2 = toCanvasCoordinates( event->snapPoint() );
305 const double initialWidthPixels = std::abs( devicePoint1.x() - devicePoint2.x() );
306 const double initialHeightPixels = std::abs( devicePoint1.y() - devicePoint2.y() );
307
308 const QFileInfo pathInfo( imagePath );
310
311 QSizeF size;
312 if ( pathInfo.suffix().compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
313 {
315 size = QgsApplication::svgCache()->svgViewboxSize( imagePath, 100, QColor(), QColor(), 1, 1 );
316 }
317 else
318 {
320 size = QgsApplication::imageCache()->originalSize( imagePath );
321 }
322
323 cadDockWidget()->clearPoints();
324
325 std::unique_ptr< QgsAnnotationPictureItem > createdItem = std::make_unique< QgsAnnotationPictureItem >( format, imagePath, QgsRectangle( point1, point2 ) );
326 if ( size.isValid() )
327 {
328 const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4;
329 if ( size.width() / size.height() > initialWidthPixels / initialHeightPixels )
330 {
331 createdItem->setFixedSize( QSizeF( initialWidthPixels / pixelsToMm, size.height() / size.width() * initialWidthPixels / pixelsToMm ) );
332 }
333 else
334 {
335 createdItem->setFixedSize( QSizeF( size.width() / size.height() * initialHeightPixels / pixelsToMm, initialHeightPixels / pixelsToMm ) );
336 }
337 createdItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters );
338 }
339
340 mHandler->pushCreatedItem( createdItem.release() );
341 }
342}
343
344void QgsCreatePictureItemMapTool::cadCanvasMoveEvent( QgsMapMouseEvent *event )
345{
346 if ( !mRubberBand )
347 return;
348
349 const QgsPointXY mapPoint = event->snapPoint();
350 mRect.setBottomRight( mapPoint.toQPointF() );
351
352 mRubberBand->reset( Qgis::GeometryType::Polygon );
353 mRubberBand->addPoint( mRect.bottomLeft(), false );
354 mRubberBand->addPoint( mRect.bottomRight(), false );
355 mRubberBand->addPoint( mRect.topRight(), false );
356 mRubberBand->addPoint( mRect.topLeft(), true );
357}
358
359void QgsCreatePictureItemMapTool::keyPressEvent( QKeyEvent *event )
360{
361 if ( event->key() == Qt::Key_Escape )
362 {
363 if ( mRubberBand )
364 {
365 mRubberBand.reset();
366 cadDockWidget()->clearPoints();
367 event->ignore();
368 }
369 }
370}
371
372QgsCreateAnnotationItemMapToolHandler *QgsCreatePictureItemMapTool::handler()
373{
374 return mHandler;
375}
376
377QgsMapTool *QgsCreatePictureItemMapTool::mapTool()
378{
379 return this;
380}
381
382
383
384//
385// QgsCreateRectangleTextItemMapTool
386//
387
388QgsCreateRectangleTextItemMapTool::QgsCreateRectangleTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
389 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
390 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
391{
392 setUseSnappingIndicator( true );
393}
394
395void QgsCreateRectangleTextItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event )
396{
397 if ( event->button() == Qt::RightButton && mRubberBand )
398 {
399 mRubberBand.reset();
400 cadDockWidget()->clearPoints();
401 return;
402 }
403
404 if ( event->button() != Qt::LeftButton )
405 return;
406
407 if ( !mRubberBand )
408 {
409 mFirstPoint = event->snapPoint();
410 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
411
412 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
413 mRubberBand->setWidth( digitizingStrokeWidth() );
414 QColor color = digitizingStrokeColor();
415
417 color.setAlphaF( color.alphaF() * alphaScale );
418 mRubberBand->setLineStyle( Qt::DotLine );
419 mRubberBand->setStrokeColor( color );
420
421 const QColor fillColor = digitizingFillColor();
422 mRubberBand->setFillColor( fillColor );
423 }
424 else
425 {
426 mRubberBand.reset();
427
428 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
429 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
430
431 cadDockWidget()->clearPoints();
432
433 std::unique_ptr< QgsAnnotationRectangleTextItem > createdItem = std::make_unique< QgsAnnotationRectangleTextItem >( tr( "Text" ), QgsRectangle( point1, point2 ) );
434
436 // default to HTML formatting
437 format.setAllowHtmlFormatting( true );
438 createdItem->setFormat( format );
439
440 // newly created rect text items default to using symbology reference scale at the current map scale
441 createdItem->setUseSymbologyReferenceScale( true );
442 createdItem->setSymbologyReferenceScale( canvas()->scale() );
443 mHandler->pushCreatedItem( createdItem.release() );
444 }
445}
446
447void QgsCreateRectangleTextItemMapTool::cadCanvasMoveEvent( QgsMapMouseEvent *event )
448{
449 if ( !mRubberBand )
450 return;
451
452 const QgsPointXY mapPoint = event->snapPoint();
453 mRect.setBottomRight( mapPoint.toQPointF() );
454
455 mRubberBand->reset( Qgis::GeometryType::Polygon );
456 mRubberBand->addPoint( mRect.bottomLeft(), false );
457 mRubberBand->addPoint( mRect.bottomRight(), false );
458 mRubberBand->addPoint( mRect.topRight(), false );
459 mRubberBand->addPoint( mRect.topLeft(), true );
460}
461
462void QgsCreateRectangleTextItemMapTool::keyPressEvent( QKeyEvent *event )
463{
464 if ( event->key() == Qt::Key_Escape )
465 {
466 if ( mRubberBand )
467 {
468 mRubberBand.reset();
469 cadDockWidget()->clearPoints();
470 event->ignore();
471 }
472 }
473}
474
475QgsCreateAnnotationItemMapToolHandler *QgsCreateRectangleTextItemMapTool::handler()
476{
477 return mHandler;
478}
479
480QgsMapTool *QgsCreateRectangleTextItemMapTool::mapTool()
481{
482 return this;
483}
484
485
486//
487// QgsCreateLineTextItemMapTool
488//
489
490QgsCreateLineTextItemMapTool::QgsCreateLineTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget )
491 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
492{
493 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
494}
495
496void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line )
497{
498 if ( line->isEmpty() )
499 return;
500
501 // do it!
502 std::unique_ptr< QgsAbstractGeometry > geometry( line->simplifiedTypeRef()->clone() );
503 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
504 {
505 std::unique_ptr< QgsAnnotationLineTextItem > createdItem = std::make_unique< QgsAnnotationLineTextItem >( tr( "Text" ), qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
506
507 std::unique_ptr< QgsLineSymbol > lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsLineSymbol >( QStringLiteral( "line_annotation_item" ) );
508 if ( !lineSymbol )
509 lineSymbol.reset( qgis::down_cast< QgsLineSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
510
512 // default to HTML formatting
513 format.setAllowHtmlFormatting( true );
514 createdItem->setFormat( format );
515
516 // newly created point text items default to using symbology reference scale at the current map scale
517 createdItem->setUseSymbologyReferenceScale( true );
518 createdItem->setSymbologyReferenceScale( canvas()->scale() );
519 mHandler->pushCreatedItem( createdItem.release() );
520 }
521}
522
CaptureTechnique
Capture technique.
Definition qgis.h:376
@ Shape
Digitize shapes.
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
@ CircularString
Capture in circular strings.
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
PictureFormat
Picture formats.
Definition qgis.h:4849
@ Raster
Raster image.
@ Unknown
Invalid or unknown image type.
@ Polygon
Polygons.
@ Millimeters
Millimeters.
virtual const QgsAbstractGeometry * simplifiedTypeRef() const
Returns a reference to the simplest lossless representation of this geometry, e.g.
virtual bool isEmpty() const
Returns true if the geometry is empty.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
static QgsRecentStyleHandler * recentStyleHandler()
Returns the handler for recently used style items.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
A handler object for map tools which create annotation items.
Curve polygon geometry type.
const QgsCurve * exteriorRing() const
Returns the curve polygon's exterior ring.
bool isEmpty() const override
Returns true if the geometry is empty.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
QSize originalSize(const QString &path, bool blocking=false) const
Returns the original size (in pixels) of the image at the specified path.
A line symbol type, for rendering LineString and MultiLineString geometries.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
QgsPointXY snapPoint()
snapPoint will snap the points using the map canvas snapping utils configuration
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates ...
QgsMapToolCapture is a base class capable of capturing point, lines and polygons.
QFlags< Capability > Capabilities
Abstract base class for all map tools.
Definition qgsmaptool.h:71
A marker symbol type, for rendering Point and MultiPoint geometries.
A class to represent a 2D point.
Definition qgspointxy.h:60
double y
Definition qgspointxy.h:64
double x
Definition qgspointxy.h:63
QPointF toQPointF() const
Converts a point to a QPointF.
Definition qgspointxy.h:165
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsSymbol * recentSymbol(const QString &identifier) const
Returns a copy of the recently used symbol with the specified identifier, or nullptr if no symbol wit...
A rectangle specified with double values.
A class for drawing transient features (e.g.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
A string settings entry.
static const QgsSettingsEntryDouble * settingsDigitizingLineColorAlphaScale
Settings entry digitizing line color alpha scale.
static QgsTextFormat defaultTextFormatForProject(QgsProject *project, QgsStyle::TextFormatContext context=QgsStyle::TextFormatContext::Labeling)
Returns the default text format to use for new text based objects for the specified project,...
@ Labeling
Text format used in labeling.
QSizeF svgViewboxSize(const QString &path, double size, const QColor &fill, const QColor &stroke, double strokeWidth, double widthScaleFactor, double fixedAspectRatio=0, bool blocking=false, const QMap< QString, QString > &parameters=QMap< QString, QString >())
Calculates the viewbox size of a (possibly cached) SVG file.
static QgsSymbol * defaultSymbol(Qgis::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Container for all settings relating to text rendering.
void setAllowHtmlFormatting(bool allow)
Sets whether text should be treated as a HTML document and HTML tags should be used for formatting th...
#define BUILTIN_UNREACHABLE
Definition qgis.h:6511