QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
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
247const QgsSettingsEntryString *QgsCreatePictureItemMapTool::settingLastSourceFolder = new QgsSettingsEntryString( u"last-source-folder"_s, sTreePicture, QString(), u"Last used folder for picture annotation source files"_s );
248
250 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
251 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
252{
253 setUseSnappingIndicator( true );
254}
255
257{
258 if ( event->button() == Qt::RightButton && mRubberBand )
259 {
260 mRubberBand.reset();
262 return;
263 }
264
265 if ( event->button() != Qt::LeftButton )
266 return;
267
268 if ( !mRubberBand )
269 {
270 mFirstPoint = event->snapPoint();
271 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
272
273 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
274 mRubberBand->setWidth( digitizingStrokeWidth() );
275 QColor color = digitizingStrokeColor();
276
278 color.setAlphaF( color.alphaF() * alphaScale );
279 mRubberBand->setLineStyle( Qt::DotLine );
280 mRubberBand->setStrokeColor( color );
281
282 const QColor fillColor = digitizingFillColor();
283 mRubberBand->setFillColor( fillColor );
284 }
285 else
286 {
287 mRubberBand.reset();
288
289 QStringList formatsFilter;
290 formatsFilter.append( u"*.svg"_s );
291 const QByteArrayList supportedFormats = QImageReader::supportedImageFormats();
292 for ( const auto &format : supportedFormats )
293 {
294 formatsFilter.append( QString( u"*.%1"_s ).arg( QString( format ) ) );
295 }
296 const QString dialogFilter = u"%1 (%2);;%3 (*.*)"_s.arg( tr( "Images" ), formatsFilter.join( ' '_L1 ), tr( "All files" ) );
297 const QString initialDir = settingLastSourceFolder->value();
298 const QString imagePath = QFileDialog::getOpenFileName( nullptr, tr( "Add Picture Annotation" ), initialDir.isEmpty() ? QDir::homePath() : initialDir, dialogFilter );
299
300 if ( imagePath.isEmpty() )
301 {
302 return; //canceled by the user
303 }
304
305 settingLastSourceFolder->setValue( QFileInfo( imagePath ).path() );
306
307 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
308 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
309
310 const QgsPointXY devicePoint1 = toCanvasCoordinates( mFirstPoint );
311 const QgsPointXY devicePoint2 = toCanvasCoordinates( event->snapPoint() );
312 const double initialWidthPixels = std::abs( devicePoint1.x() - devicePoint2.x() );
313 const double initialHeightPixels = std::abs( devicePoint1.y() - devicePoint2.y() );
314
315 const QFileInfo pathInfo( imagePath );
317
318 QSizeF size;
319 if ( pathInfo.suffix().compare( "svg"_L1, Qt::CaseInsensitive ) == 0 )
320 {
322 size = QgsApplication::svgCache()->svgViewboxSize( imagePath, 100, QColor(), QColor(), 1, 1 );
323 }
324 else
325 {
327 size = QgsApplication::imageCache()->originalSize( imagePath );
328 }
329
331
332 auto createdItem = std::make_unique<QgsAnnotationPictureItem>( format, imagePath, QgsRectangle( point1, point2 ) );
333 if ( size.isValid() )
334 {
335 const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4;
336 if ( size.width() / size.height() > initialWidthPixels / initialHeightPixels )
337 {
338 createdItem->setFixedSize( QSizeF( initialWidthPixels / pixelsToMm, size.height() / size.width() * initialWidthPixels / pixelsToMm ) );
339 }
340 else
341 {
342 createdItem->setFixedSize( QSizeF( size.width() / size.height() * initialHeightPixels / pixelsToMm, initialHeightPixels / pixelsToMm ) );
343 }
344 createdItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters );
345 }
346
347 mHandler->pushCreatedItem( createdItem.release() );
348 }
349}
350
352{
353 if ( !mRubberBand )
354 return;
355
356 const QgsPointXY mapPoint = event->snapPoint();
357 mRect.setBottomRight( mapPoint.toQPointF() );
358
359 mRubberBand->reset( Qgis::GeometryType::Polygon );
360 mRubberBand->addPoint( mRect.bottomLeft(), false );
361 mRubberBand->addPoint( mRect.bottomRight(), false );
362 mRubberBand->addPoint( mRect.topRight(), false );
363 mRubberBand->addPoint( mRect.topLeft(), true );
364}
365
366void QgsCreatePictureItemMapTool::keyPressEvent( QKeyEvent *event )
367{
368 if ( event->key() == Qt::Key_Escape )
369 {
370 if ( mRubberBand )
371 {
372 mRubberBand.reset();
374 event->ignore();
375 }
376 }
377}
378
380{
381 return mHandler;
382}
383
385{
386 return this;
387}
388
389
390//
391// QgsCreateRectangleTextItemMapTool
392//
393
395 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
396 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
397{
398 setUseSnappingIndicator( true );
399}
400
402{
403 if ( event->button() == Qt::RightButton && mRubberBand )
404 {
405 mRubberBand.reset();
407 return;
408 }
409
410 if ( event->button() != Qt::LeftButton )
411 return;
412
413 if ( !mRubberBand )
414 {
415 mFirstPoint = event->snapPoint();
416 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
417
418 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
419 mRubberBand->setWidth( digitizingStrokeWidth() );
420 QColor color = digitizingStrokeColor();
421
423 color.setAlphaF( color.alphaF() * alphaScale );
424 mRubberBand->setLineStyle( Qt::DotLine );
425 mRubberBand->setStrokeColor( color );
426
427 const QColor fillColor = digitizingFillColor();
428 mRubberBand->setFillColor( fillColor );
429 }
430 else
431 {
432 mRubberBand.reset();
433
434 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
435 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
436
438
439 auto createdItem = std::make_unique<QgsAnnotationRectangleTextItem>( tr( "Text" ), QgsRectangle( point1, point2 ) );
440
442 // default to HTML formatting
443 format.setAllowHtmlFormatting( true );
444 createdItem->setFormat( format );
445
446 // newly created rect text items default to using symbology reference scale at the current map scale
447 createdItem->setUseSymbologyReferenceScale( true );
448 createdItem->setSymbologyReferenceScale( canvas()->scale() );
449 mHandler->pushCreatedItem( createdItem.release() );
450 }
451}
452
454{
455 if ( !mRubberBand )
456 return;
457
458 const QgsPointXY mapPoint = event->snapPoint();
459 mRect.setBottomRight( mapPoint.toQPointF() );
460
461 mRubberBand->reset( Qgis::GeometryType::Polygon );
462 mRubberBand->addPoint( mRect.bottomLeft(), false );
463 mRubberBand->addPoint( mRect.bottomRight(), false );
464 mRubberBand->addPoint( mRect.topRight(), false );
465 mRubberBand->addPoint( mRect.topLeft(), true );
466}
467
469{
470 if ( event->key() == Qt::Key_Escape )
471 {
472 if ( mRubberBand )
473 {
474 mRubberBand.reset();
476 event->ignore();
477 }
478 }
479}
480
482{
483 return mHandler;
484}
485
487{
488 return this;
489}
490
491
492//
493// QgsCreateLineTextItemMapTool
494//
495
497 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
498{
499 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
500}
501
502void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line )
503{
504 if ( line->isEmpty() )
505 return;
506
507 // do it!
508 std::unique_ptr<QgsAbstractGeometry> geometry( line->simplifiedTypeRef()->clone() );
509 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
510 {
511 auto createdItem = std::make_unique<QgsAnnotationLineTextItem>( tr( "Text" ), qgis::down_cast<QgsCurve *>( geometry.release() ) );
512
513 std::unique_ptr<QgsLineSymbol> lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsLineSymbol>( u"line_annotation_item"_s );
514 if ( !lineSymbol )
515 lineSymbol.reset( qgis::down_cast<QgsLineSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
516
518 // default to HTML formatting
519 format.setAllowHtmlFormatting( true );
520 createdItem->setFormat( format );
521
522 // newly created point text items default to using symbology reference scale at the current map scale
523 createdItem->setUseSymbologyReferenceScale( true );
524 createdItem->setSymbologyReferenceScale( canvas()->scale() );
525 mHandler->pushCreatedItem( createdItem.release() );
526 }
527}
528
CaptureTechnique
Capture technique.
Definition qgis.h:415
@ NurbsCurve
Digitizes NURBS curves with control points (curve is attracted to but does not pass through control p...
Definition qgis.h:421
@ Shape
Digitize shapes.
Definition qgis.h:419
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
Definition qgis.h:416
@ CircularString
Capture in circular strings.
Definition qgis.h:417
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
Definition qgis.h:418
@ PolyBezier
Digitizes poly-Bézier curves with anchors and tangent handles (curve passes through anchor points).
Definition qgis.h:420
PictureFormat
Picture formats.
Definition qgis.h:5394
@ Raster
Raster image.
Definition qgis.h:5396
@ Unknown
Invalid or unknown image type.
Definition qgis.h:5397
@ SVG
SVG image.
Definition qgis.h:5395
@ Point
Points.
Definition qgis.h:377
@ Line
Lines.
Definition qgis.h:378
@ Polygon
Polygons.
Definition qgis.h:379
@ Millimeters
Millimeters.
Definition qgis.h:5306
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:167
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:813
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:7539
T qgsgeometry_cast(QgsAbstractGeometry *geom)