QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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
19#include "qgsannotationlayer.h"
27#include "qgsapplication.h"
28#include "qgscurvepolygon.h"
29#include "qgsfillsymbol.h"
30#include "qgsimagecache.h"
31#include "qgslinesymbol.h"
32#include "qgsmapcanvas.h"
33#include "qgsmapmouseevent.h"
34#include "qgsmarkersymbol.h"
36#include "qgsrubberband.h"
38#include "qgsstyle.h"
39#include "qgssvgcache.h"
40
41#include <QFileDialog>
42#include <QImageReader>
43#include <QString>
44
45#include "moc_qgscreateannotationitemmaptool_impl.cpp"
46
47using namespace Qt::StringLiterals;
48
50
51//
52// QgsMapToolCaptureAnnotationItem
53//
54
56 : QgsMapToolCapture( canvas, cadDockWidget, mode )
57{
58 mToolName = tr( "Annotation tool" );
59}
60
62{
63 return mHandler;
64}
65
67{
68 return this;
69}
70
72{
73 return mHandler->targetLayer();
74}
75
76
78{
79 // no geometry validation!
80 return SupportsCurves;
81}
82
84{
85 switch ( technique )
86 {
93 return true;
94 }
96}
97
98
99//
100// QgsCreatePointTextItemMapTool
101//
102
104 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
105 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget ) )
106{
107 setUseSnappingIndicator( true );
108}
109
111
113{
114 if ( event->button() != Qt::LeftButton )
115 return;
116
117 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
118
119 auto createdItem = std::make_unique<QgsAnnotationPointTextItem>( tr( "Text" ), layerPoint );
120 createdItem->setAlignment( Qt::AlignLeft );
122 // default to HTML formatting
123 format.setAllowHtmlFormatting( true );
124 createdItem->setFormat( format );
125 // newly created point text items default to using symbology reference scale at the current map scale
126 createdItem->setUseSymbologyReferenceScale( true );
127 createdItem->setSymbologyReferenceScale( canvas()->scale() );
128 mHandler->pushCreatedItem( createdItem.release() );
129}
130
132{
133 return mHandler;
134}
135
137{
138 return this;
139}
140
141
142//
143// QgsCreateMarkerMapTool
144//
145
147 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePoint )
148{
149 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
150}
151
153{
154 if ( event->button() != Qt::LeftButton )
155 return;
156
157 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
158 auto createdItem = std::make_unique<QgsAnnotationMarkerItem>( QgsPoint( layerPoint ) );
159
160 std::unique_ptr<QgsMarkerSymbol> markerSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsMarkerSymbol>( u"marker_annotation_item"_s );
161 if ( !markerSymbol )
162 markerSymbol.reset( qgis::down_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) );
163 createdItem->setSymbol( markerSymbol.release() );
164
165 // set reference scale to match canvas scale, but don't enable it by default for marker items
166 createdItem->setSymbologyReferenceScale( canvas()->scale() );
167
168 mHandler->pushCreatedItem( createdItem.release() );
169
171
173}
174
175//
176// QgsCreateLineMapTool
177//
178
180 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
181{
182 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
183}
184
185void QgsCreateLineItemMapTool::lineCaptured( const QgsCurve *line )
186{
187 if ( line->isEmpty() )
188 return;
189
190 // do it!
191 std::unique_ptr<QgsAbstractGeometry> geometry( line->simplifiedTypeRef()->clone() );
192 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
193 {
194 auto createdItem = std::make_unique<QgsAnnotationLineItem>( qgis::down_cast<QgsCurve *>( geometry.release() ) );
195
196 std::unique_ptr<QgsLineSymbol> lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsLineSymbol>( u"line_annotation_item"_s );
197 if ( !lineSymbol )
198 lineSymbol.reset( qgis::down_cast<QgsLineSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
199 createdItem->setSymbol( lineSymbol.release() );
200
201 // set reference scale to match canvas scale, but don't enable it by default for marker items
202 createdItem->setSymbologyReferenceScale( canvas()->scale() );
203
204 mHandler->pushCreatedItem( createdItem.release() );
205 }
206}
207
208//
209// QgsCreatePolygonItemMapTool
210//
211
213 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePolygon )
214{
215 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
216}
217
218void QgsCreatePolygonItemMapTool::polygonCaptured( const QgsCurvePolygon *polygon )
219{
220 if ( polygon->isEmpty() )
221 return;
222
223 std::unique_ptr<QgsAbstractGeometry> geometry( polygon->exteriorRing()->simplifiedTypeRef()->clone() );
224 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
225 {
226 auto newPolygon = std::make_unique<QgsCurvePolygon>();
227 newPolygon->setExteriorRing( qgis::down_cast<QgsCurve *>( geometry.release() ) );
228 auto createdItem = std::make_unique<QgsAnnotationPolygonItem>( newPolygon.release() );
229
230 std::unique_ptr<QgsFillSymbol> fillSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsFillSymbol>( u"polygon_annotation_item"_s );
231 if ( !fillSymbol )
232 fillSymbol.reset( qgis::down_cast<QgsFillSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ) );
233 createdItem->setSymbol( fillSymbol.release() );
234
235 // set reference scale to match canvas scale, but don't enable it by default for marker items
236 createdItem->setSymbologyReferenceScale( canvas()->scale() );
237
238 mHandler->pushCreatedItem( createdItem.release() );
239 }
240}
241
242
243//
244// QgsCreatePictureItemMapTool
245//
246
248 = new QgsSettingsEntryString( u"last-source-folder"_s, sTreePicture, QString(), u"Last used folder for picture annotation source files"_s );
249
251 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
252 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
253{
254 setUseSnappingIndicator( true );
255}
256
258{
259 if ( event->button() == Qt::RightButton && mRubberBand )
260 {
261 mRubberBand.reset();
263 return;
264 }
265
266 if ( event->button() != Qt::LeftButton )
267 return;
268
269 if ( !mRubberBand )
270 {
271 mFirstPoint = event->snapPoint();
272 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
273
274 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
275 mRubberBand->setWidth( digitizingStrokeWidth() );
276 QColor color = digitizingStrokeColor();
277
279 color.setAlphaF( color.alphaF() * alphaScale );
280 mRubberBand->setLineStyle( Qt::DotLine );
281 mRubberBand->setStrokeColor( color );
282
283 const QColor fillColor = digitizingFillColor();
284 mRubberBand->setFillColor( fillColor );
285 }
286 else
287 {
288 mRubberBand.reset();
289
290 QStringList formatsFilter;
291 formatsFilter.append( u"*.svg"_s );
292 const QByteArrayList supportedFormats = QImageReader::supportedImageFormats();
293 for ( const auto &format : supportedFormats )
294 {
295 formatsFilter.append( QString( u"*.%1"_s ).arg( QString( format ) ) );
296 }
297 const QString dialogFilter = u"%1 (%2);;%3 (*.*)"_s.arg( tr( "Images" ), formatsFilter.join( ' '_L1 ), tr( "All files" ) );
298 const QString initialDir = settingLastSourceFolder->value();
299 const QString imagePath = QFileDialog::getOpenFileName( nullptr, tr( "Add Picture Annotation" ), initialDir.isEmpty() ? QDir::homePath() : initialDir, dialogFilter );
300
301 if ( imagePath.isEmpty() )
302 {
303 return; //canceled by the user
304 }
305
306 settingLastSourceFolder->setValue( QFileInfo( imagePath ).path() );
307
308 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
309 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
310
311 const QgsPointXY devicePoint1 = toCanvasCoordinates( mFirstPoint );
312 const QgsPointXY devicePoint2 = toCanvasCoordinates( event->snapPoint() );
313 const double initialWidthPixels = std::abs( devicePoint1.x() - devicePoint2.x() );
314 const double initialHeightPixels = std::abs( devicePoint1.y() - devicePoint2.y() );
315
316 const QFileInfo pathInfo( imagePath );
318
319 QSizeF size;
320 if ( pathInfo.suffix().compare( "svg"_L1, Qt::CaseInsensitive ) == 0 )
321 {
323 size = QgsApplication::svgCache()->svgViewboxSize( imagePath, 100, QColor(), QColor(), 1, 1 );
324 }
325 else
326 {
328 size = QgsApplication::imageCache()->originalSize( imagePath );
329 }
330
332
333 auto createdItem = std::make_unique<QgsAnnotationPictureItem>( format, imagePath, QgsRectangle( point1, point2 ) );
334 if ( size.isValid() )
335 {
336 const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4;
337 if ( size.width() / size.height() > initialWidthPixels / initialHeightPixels )
338 {
339 createdItem->setFixedSize( QSizeF( initialWidthPixels / pixelsToMm, size.height() / size.width() * initialWidthPixels / pixelsToMm ) );
340 }
341 else
342 {
343 createdItem->setFixedSize( QSizeF( size.width() / size.height() * initialHeightPixels / pixelsToMm, initialHeightPixels / pixelsToMm ) );
344 }
345 createdItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters );
346 }
347
348 mHandler->pushCreatedItem( createdItem.release() );
349 }
350}
351
353{
354 if ( !mRubberBand )
355 return;
356
357 const QgsPointXY mapPoint = event->snapPoint();
358 mRect.setBottomRight( mapPoint.toQPointF() );
359
360 mRubberBand->reset( Qgis::GeometryType::Polygon );
361 mRubberBand->addPoint( mRect.bottomLeft(), false );
362 mRubberBand->addPoint( mRect.bottomRight(), false );
363 mRubberBand->addPoint( mRect.topRight(), false );
364 mRubberBand->addPoint( mRect.topLeft(), true );
365}
366
367void QgsCreatePictureItemMapTool::keyPressEvent( QKeyEvent *event )
368{
369 if ( event->key() == Qt::Key_Escape )
370 {
371 if ( mRubberBand )
372 {
373 mRubberBand.reset();
375 event->ignore();
376 }
377 }
378}
379
381{
382 return mHandler;
383}
384
386{
387 return this;
388}
389
390
391//
392// QgsCreateRectangleTextItemMapTool
393//
394
396 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
397 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
398{
399 setUseSnappingIndicator( true );
400}
401
403{
404 if ( event->button() == Qt::RightButton && mRubberBand )
405 {
406 mRubberBand.reset();
408 return;
409 }
410
411 if ( event->button() != Qt::LeftButton )
412 return;
413
414 if ( !mRubberBand )
415 {
416 mFirstPoint = event->snapPoint();
417 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
418
419 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
420 mRubberBand->setWidth( digitizingStrokeWidth() );
421 QColor color = digitizingStrokeColor();
422
424 color.setAlphaF( color.alphaF() * alphaScale );
425 mRubberBand->setLineStyle( Qt::DotLine );
426 mRubberBand->setStrokeColor( color );
427
428 const QColor fillColor = digitizingFillColor();
429 mRubberBand->setFillColor( fillColor );
430 }
431 else
432 {
433 mRubberBand.reset();
434
435 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
436 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
437
439
440 auto createdItem = std::make_unique<QgsAnnotationRectangleTextItem>( tr( "Text" ), QgsRectangle( point1, point2 ) );
441
443 // default to HTML formatting
444 format.setAllowHtmlFormatting( true );
445 createdItem->setFormat( format );
446
447 // newly created rect text items default to using symbology reference scale at the current map scale
448 createdItem->setUseSymbologyReferenceScale( true );
449 createdItem->setSymbologyReferenceScale( canvas()->scale() );
450 mHandler->pushCreatedItem( createdItem.release() );
451 }
452}
453
455{
456 if ( !mRubberBand )
457 return;
458
459 const QgsPointXY mapPoint = event->snapPoint();
460 mRect.setBottomRight( mapPoint.toQPointF() );
461
462 mRubberBand->reset( Qgis::GeometryType::Polygon );
463 mRubberBand->addPoint( mRect.bottomLeft(), false );
464 mRubberBand->addPoint( mRect.bottomRight(), false );
465 mRubberBand->addPoint( mRect.topRight(), false );
466 mRubberBand->addPoint( mRect.topLeft(), true );
467}
468
470{
471 if ( event->key() == Qt::Key_Escape )
472 {
473 if ( mRubberBand )
474 {
475 mRubberBand.reset();
477 event->ignore();
478 }
479 }
480}
481
483{
484 return mHandler;
485}
486
488{
489 return this;
490}
491
492
493//
494// QgsCreateLineTextItemMapTool
495//
496
498 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
499{
500 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
501}
502
503void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line )
504{
505 if ( line->isEmpty() )
506 return;
507
508 // do it!
509 std::unique_ptr<QgsAbstractGeometry> geometry( line->simplifiedTypeRef()->clone() );
510 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
511 {
512 auto createdItem = std::make_unique<QgsAnnotationLineTextItem>( tr( "Text" ), qgis::down_cast<QgsCurve *>( geometry.release() ) );
513
514 std::unique_ptr<QgsLineSymbol> lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsLineSymbol>( u"line_annotation_item"_s );
515 if ( !lineSymbol )
516 lineSymbol.reset( qgis::down_cast<QgsLineSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
517
519 // default to HTML formatting
520 format.setAllowHtmlFormatting( true );
521 createdItem->setFormat( format );
522
523 // newly created point text items default to using symbology reference scale at the current map scale
524 createdItem->setUseSymbologyReferenceScale( true );
525 createdItem->setSymbologyReferenceScale( canvas()->scale() );
526 mHandler->pushCreatedItem( createdItem.release() );
527 }
528}
529
CaptureTechnique
Capture technique.
Definition qgis.h:418
@ NurbsCurve
Digitizes NURBS curves with control points (curve is attracted to but does not pass through control p...
Definition qgis.h:424
@ Shape
Digitize shapes.
Definition qgis.h:422
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
Definition qgis.h:419
@ CircularString
Capture in circular strings.
Definition qgis.h:420
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
Definition qgis.h:421
@ PolyBezier
Digitizes poly-Bézier curves with anchors and tangent handles (curve passes through anchor points).
Definition qgis.h:423
PictureFormat
Picture formats.
Definition qgis.h:5434
@ Raster
Raster image.
Definition qgis.h:5436
@ Unknown
Invalid or unknown image type.
Definition qgis.h:5437
@ SVG
SVG image.
Definition qgis.h:5435
@ Point
Points.
Definition qgis.h:380
@ Line
Lines.
Definition qgis.h:381
@ Polygon
Polygons.
Definition qgis.h:382
@ Millimeters
Millimeters.
Definition qgis.h:5341
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.
A dockable widget used to handle the CAD tools on top of a selection of map tools.
void clearPoints()
Removes all points from the CAD point list.
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.
QgsCreateLineItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateLineTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateMarkerItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
void cadCanvasReleaseEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void cadCanvasMoveEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
static const QgsSettingsEntryString * settingLastSourceFolder
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void keyPressEvent(QKeyEvent *event) override
Key event for overriding. Default implementation does nothing.
QgsCreatePictureItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
~QgsCreatePointTextItemMapTool() override
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
QgsCreatePointTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
QgsCreatePolygonItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateRectangleTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
void cadCanvasMoveEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void keyPressEvent(QKeyEvent *event) override
Key event for overriding. Default implementation does nothing.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
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:36
QSize originalSize(const QString &path, bool blocking=false) const
Returns the original size (in pixels) of the image at the specified path.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:83
A mouse event which is the result of a user interaction with 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
A QgsMapTool which gives events directly in map coordinates and allows filtering of events.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
A base class to digitize annotation items using QgsMapToolCapture.
QgsMapToolCaptureAnnotationItem(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
bool supportsTechnique(Qgis::CaptureTechnique technique) const override
Returns true if the tool supports the specified capture technique.
QgsMapLayer * layer() const override
Returns the layer associated with the map tool.
QgsCreateAnnotationItemMapToolHandler * mHandler
QgsMapToolCapture::Capabilities capabilities() const override
Returns flags containing the supported capabilities.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
Base class for map tools capable of capturing point, lines and polygons.
void stopCapturing()
Stop capturing.
QFlags< Capability > Capabilities
@ SupportsCurves
Supports curved geometries input.
static QColor digitizingFillColor()
Returns fill color for rubber bands (from global settings).
static QColor digitizingStrokeColor()
Returns stroke color for rubber bands (from global settings).
static int digitizingStrokeWidth()
Returns stroke width for rubber bands (from global settings).
Abstract base class for all map tools.
Definition qgsmaptool.h:72
QgsPoint toLayerCoordinates(const QgsMapLayer *layer, const QgsPoint &point)
Transforms a point from map coordinates to layer coordinates.
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
QPointer< QgsMapCanvas > mCanvas
The pointer to the map canvas.
Definition qgsmaptool.h:369
QPoint toCanvasCoordinates(const QgsPointXY &point) const
Transforms a point from map coordinates to screen coordinates.
double y
Definition qgspointxy.h:66
double x
Definition qgspointxy.h:65
QPointF toQPointF() const
Converts a point to a QPointF.
Definition qgspointxy.h:168
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...
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.
Definition qgsstyle.h:811
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.
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:7540
T qgsgeometry_cast(QgsAbstractGeometry *geom)