QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
44#include "moc_qgscreateannotationitemmaptool_impl.cpp"
45
47
48//
49// QgsMapToolCaptureAnnotationItem
50//
51
53 : QgsMapToolCapture( canvas, cadDockWidget, mode )
54{
55 mToolName = tr( "Annotation tool" );
56}
57
59{
60 return mHandler;
61}
62
64{
65 return this;
66}
67
69{
70 return mHandler->targetLayer();
71}
72
73
75{
76 // no geometry validation!
77 return SupportsCurves;
78}
79
81{
82 switch ( technique )
83 {
88 return true;
89 }
91}
92
93
94//
95// QgsCreatePointTextItemMapTool
96//
97
99 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
100 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget ) )
101{
102 setUseSnappingIndicator( true );
103}
104
106
108{
109 if ( event->button() != Qt::LeftButton )
110 return;
111
112 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
113
114 auto createdItem = std::make_unique<QgsAnnotationPointTextItem>( tr( "Text" ), layerPoint );
115 createdItem->setAlignment( Qt::AlignLeft );
117 // default to HTML formatting
118 format.setAllowHtmlFormatting( true );
119 createdItem->setFormat( format );
120 // newly created point text items default to using symbology reference scale at the current map scale
121 createdItem->setUseSymbologyReferenceScale( true );
122 createdItem->setSymbologyReferenceScale( canvas()->scale() );
123 mHandler->pushCreatedItem( createdItem.release() );
124}
125
127{
128 return mHandler;
129}
130
132{
133 return this;
134}
135
136
137//
138// QgsCreateMarkerMapTool
139//
140
142 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePoint )
143{
144 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
145}
146
148{
149 if ( event->button() != Qt::LeftButton )
150 return;
151
152 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
153 auto createdItem = std::make_unique<QgsAnnotationMarkerItem>( QgsPoint( layerPoint ) );
154
155 std::unique_ptr<QgsMarkerSymbol> markerSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsMarkerSymbol>( QStringLiteral( "marker_annotation_item" ) );
156 if ( !markerSymbol )
157 markerSymbol.reset( qgis::down_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) );
158 createdItem->setSymbol( markerSymbol.release() );
159
160 // set reference scale to match canvas scale, but don't enable it by default for marker items
161 createdItem->setSymbologyReferenceScale( canvas()->scale() );
162
163 mHandler->pushCreatedItem( createdItem.release() );
164
166
168}
169
170//
171// QgsCreateLineMapTool
172//
173
175 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
176{
177 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
178}
179
180void QgsCreateLineItemMapTool::lineCaptured( const QgsCurve *line )
181{
182 if ( line->isEmpty() )
183 return;
184
185 // do it!
186 std::unique_ptr<QgsAbstractGeometry> geometry( line->simplifiedTypeRef()->clone() );
187 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
188 {
189 auto createdItem = std::make_unique<QgsAnnotationLineItem>( qgis::down_cast<QgsCurve *>( geometry.release() ) );
190
191 std::unique_ptr<QgsLineSymbol> lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsLineSymbol>( QStringLiteral( "line_annotation_item" ) );
192 if ( !lineSymbol )
193 lineSymbol.reset( qgis::down_cast<QgsLineSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
194 createdItem->setSymbol( lineSymbol.release() );
195
196 // set reference scale to match canvas scale, but don't enable it by default for marker items
197 createdItem->setSymbologyReferenceScale( canvas()->scale() );
198
199 mHandler->pushCreatedItem( createdItem.release() );
200 }
201}
202
203//
204// QgsCreatePolygonItemMapTool
205//
206
208 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePolygon )
209{
210 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
211}
212
213void QgsCreatePolygonItemMapTool::polygonCaptured( const QgsCurvePolygon *polygon )
214{
215 if ( polygon->isEmpty() )
216 return;
217
218 std::unique_ptr<QgsAbstractGeometry> geometry( polygon->exteriorRing()->simplifiedTypeRef()->clone() );
219 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
220 {
221 auto newPolygon = std::make_unique<QgsCurvePolygon>();
222 newPolygon->setExteriorRing( qgis::down_cast<QgsCurve *>( geometry.release() ) );
223 auto createdItem = std::make_unique<QgsAnnotationPolygonItem>( newPolygon.release() );
224
225 std::unique_ptr<QgsFillSymbol> fillSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsFillSymbol>( QStringLiteral( "polygon_annotation_item" ) );
226 if ( !fillSymbol )
227 fillSymbol.reset( qgis::down_cast<QgsFillSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ) );
228 createdItem->setSymbol( fillSymbol.release() );
229
230 // set reference scale to match canvas scale, but don't enable it by default for marker items
231 createdItem->setSymbologyReferenceScale( canvas()->scale() );
232
233 mHandler->pushCreatedItem( createdItem.release() );
234 }
235}
236
237
238//
239// QgsCreatePictureItemMapTool
240//
241
242const QgsSettingsEntryString *QgsCreatePictureItemMapTool::settingLastSourceFolder = new QgsSettingsEntryString( QStringLiteral( "last-source-folder" ), sTreePicture, QString(), QStringLiteral( "Last used folder for picture annotation source files" ) );
243
245 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
246 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
247{
248 setUseSnappingIndicator( true );
249}
250
252{
253 if ( event->button() == Qt::RightButton && mRubberBand )
254 {
255 mRubberBand.reset();
257 return;
258 }
259
260 if ( event->button() != Qt::LeftButton )
261 return;
262
263 if ( !mRubberBand )
264 {
265 mFirstPoint = event->snapPoint();
266 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
267
268 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
269 mRubberBand->setWidth( digitizingStrokeWidth() );
270 QColor color = digitizingStrokeColor();
271
273 color.setAlphaF( color.alphaF() * alphaScale );
274 mRubberBand->setLineStyle( Qt::DotLine );
275 mRubberBand->setStrokeColor( color );
276
277 const QColor fillColor = digitizingFillColor();
278 mRubberBand->setFillColor( fillColor );
279 }
280 else
281 {
282 mRubberBand.reset();
283
284 QStringList formatsFilter;
285 formatsFilter.append( QStringLiteral( "*.svg" ) );
286 const QByteArrayList supportedFormats = QImageReader::supportedImageFormats();
287 for ( const auto &format : supportedFormats )
288 {
289 formatsFilter.append( QString( QStringLiteral( "*.%1" ) ).arg( QString( format ) ) );
290 }
291 const QString dialogFilter = QStringLiteral( "%1 (%2);;%3 (*.*)" ).arg( tr( "Images" ), formatsFilter.join( QLatin1Char( ' ' ) ), tr( "All files" ) );
292 const QString initialDir = settingLastSourceFolder->value();
293 const QString imagePath = QFileDialog::getOpenFileName( nullptr, tr( "Add Picture Annotation" ), initialDir.isEmpty() ? QDir::homePath() : initialDir, dialogFilter );
294
295 if ( imagePath.isEmpty() )
296 {
297 return; //canceled by the user
298 }
299
300 settingLastSourceFolder->setValue( QFileInfo( imagePath ).path() );
301
302 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
303 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
304
305 const QgsPointXY devicePoint1 = toCanvasCoordinates( mFirstPoint );
306 const QgsPointXY devicePoint2 = toCanvasCoordinates( event->snapPoint() );
307 const double initialWidthPixels = std::abs( devicePoint1.x() - devicePoint2.x() );
308 const double initialHeightPixels = std::abs( devicePoint1.y() - devicePoint2.y() );
309
310 const QFileInfo pathInfo( imagePath );
312
313 QSizeF size;
314 if ( pathInfo.suffix().compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
315 {
317 size = QgsApplication::svgCache()->svgViewboxSize( imagePath, 100, QColor(), QColor(), 1, 1 );
318 }
319 else
320 {
322 size = QgsApplication::imageCache()->originalSize( imagePath );
323 }
324
326
327 auto createdItem = std::make_unique<QgsAnnotationPictureItem>( format, imagePath, QgsRectangle( point1, point2 ) );
328 if ( size.isValid() )
329 {
330 const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4;
331 if ( size.width() / size.height() > initialWidthPixels / initialHeightPixels )
332 {
333 createdItem->setFixedSize( QSizeF( initialWidthPixels / pixelsToMm, size.height() / size.width() * initialWidthPixels / pixelsToMm ) );
334 }
335 else
336 {
337 createdItem->setFixedSize( QSizeF( size.width() / size.height() * initialHeightPixels / pixelsToMm, initialHeightPixels / pixelsToMm ) );
338 }
339 createdItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters );
340 }
341
342 mHandler->pushCreatedItem( createdItem.release() );
343 }
344}
345
347{
348 if ( !mRubberBand )
349 return;
350
351 const QgsPointXY mapPoint = event->snapPoint();
352 mRect.setBottomRight( mapPoint.toQPointF() );
353
354 mRubberBand->reset( Qgis::GeometryType::Polygon );
355 mRubberBand->addPoint( mRect.bottomLeft(), false );
356 mRubberBand->addPoint( mRect.bottomRight(), false );
357 mRubberBand->addPoint( mRect.topRight(), false );
358 mRubberBand->addPoint( mRect.topLeft(), true );
359}
360
361void QgsCreatePictureItemMapTool::keyPressEvent( QKeyEvent *event )
362{
363 if ( event->key() == Qt::Key_Escape )
364 {
365 if ( mRubberBand )
366 {
367 mRubberBand.reset();
369 event->ignore();
370 }
371 }
372}
373
375{
376 return mHandler;
377}
378
380{
381 return this;
382}
383
384
385//
386// QgsCreateRectangleTextItemMapTool
387//
388
390 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
391 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
392{
393 setUseSnappingIndicator( true );
394}
395
397{
398 if ( event->button() == Qt::RightButton && mRubberBand )
399 {
400 mRubberBand.reset();
402 return;
403 }
404
405 if ( event->button() != Qt::LeftButton )
406 return;
407
408 if ( !mRubberBand )
409 {
410 mFirstPoint = event->snapPoint();
411 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
412
413 mRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Polygon ) );
414 mRubberBand->setWidth( digitizingStrokeWidth() );
415 QColor color = digitizingStrokeColor();
416
418 color.setAlphaF( color.alphaF() * alphaScale );
419 mRubberBand->setLineStyle( Qt::DotLine );
420 mRubberBand->setStrokeColor( color );
421
422 const QColor fillColor = digitizingFillColor();
423 mRubberBand->setFillColor( fillColor );
424 }
425 else
426 {
427 mRubberBand.reset();
428
429 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
430 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
431
433
434 auto createdItem = std::make_unique<QgsAnnotationRectangleTextItem>( tr( "Text" ), QgsRectangle( point1, point2 ) );
435
437 // default to HTML formatting
438 format.setAllowHtmlFormatting( true );
439 createdItem->setFormat( format );
440
441 // newly created rect text items default to using symbology reference scale at the current map scale
442 createdItem->setUseSymbologyReferenceScale( true );
443 createdItem->setSymbologyReferenceScale( canvas()->scale() );
444 mHandler->pushCreatedItem( createdItem.release() );
445 }
446}
447
449{
450 if ( !mRubberBand )
451 return;
452
453 const QgsPointXY mapPoint = event->snapPoint();
454 mRect.setBottomRight( mapPoint.toQPointF() );
455
456 mRubberBand->reset( Qgis::GeometryType::Polygon );
457 mRubberBand->addPoint( mRect.bottomLeft(), false );
458 mRubberBand->addPoint( mRect.bottomRight(), false );
459 mRubberBand->addPoint( mRect.topRight(), false );
460 mRubberBand->addPoint( mRect.topLeft(), true );
461}
462
464{
465 if ( event->key() == Qt::Key_Escape )
466 {
467 if ( mRubberBand )
468 {
469 mRubberBand.reset();
471 event->ignore();
472 }
473 }
474}
475
477{
478 return mHandler;
479}
480
482{
483 return this;
484}
485
486
487//
488// QgsCreateLineTextItemMapTool
489//
490
492 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
493{
494 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
495}
496
497void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line )
498{
499 if ( line->isEmpty() )
500 return;
501
502 // do it!
503 std::unique_ptr<QgsAbstractGeometry> geometry( line->simplifiedTypeRef()->clone() );
504 if ( qgsgeometry_cast<QgsCurve *>( geometry.get() ) )
505 {
506 auto createdItem = std::make_unique<QgsAnnotationLineTextItem>( tr( "Text" ), qgis::down_cast<QgsCurve *>( geometry.release() ) );
507
508 std::unique_ptr<QgsLineSymbol> lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol<QgsLineSymbol>( QStringLiteral( "line_annotation_item" ) );
509 if ( !lineSymbol )
510 lineSymbol.reset( qgis::down_cast<QgsLineSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
511
513 // default to HTML formatting
514 format.setAllowHtmlFormatting( true );
515 createdItem->setFormat( format );
516
517 // newly created point text items default to using symbology reference scale at the current map scale
518 createdItem->setUseSymbologyReferenceScale( true );
519 createdItem->setSymbologyReferenceScale( canvas()->scale() );
520 mHandler->pushCreatedItem( createdItem.release() );
521 }
522}
523
CaptureTechnique
Capture technique.
Definition qgis.h:397
@ Shape
Digitize shapes.
Definition qgis.h:401
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
Definition qgis.h:398
@ CircularString
Capture in circular strings.
Definition qgis.h:399
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
Definition qgis.h:400
PictureFormat
Picture formats.
Definition qgis.h:5272
@ Raster
Raster image.
Definition qgis.h:5274
@ Unknown
Invalid or unknown image type.
Definition qgis.h:5275
@ SVG
SVG image.
Definition qgis.h:5273
@ Point
Points.
Definition qgis.h:359
@ Line
Lines.
Definition qgis.h:360
@ Polygon
Polygons.
Definition qgis.h:361
@ Millimeters
Millimeters.
Definition qgis.h:5184
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:80
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:361
QPoint toCanvasCoordinates(const QgsPointXY &point) const
Transforms a point from map coordinates to screen coordinates.
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
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:812
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:7208
T qgsgeometry_cast(QgsAbstractGeometry *geom)