QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
17 #ifndef QGSLAYOUTITEMPICTURE_H
18 #define QGSLAYOUTITEMPICTURE_H
20 #include "qgis_core.h"
24 #include <QSvgRenderer>
74 int type()
const override;
75 QIcon
icon()
const override;
94 void setPicturePath(
const QString &path, Format format = FormatUnknown );
103 QString picturePath()
const;
138 NorthMode northMode()
const;
145 void setNorthMode( NorthMode mode );
152 double northOffset()
const;
159 void setNorthOffset(
double offset );
196 void setSvgFillColor(
const QColor &color );
213 void setSvgStrokeColor(
const QColor &color );
229 void setSvgStrokeWidth(
double width );
242 void setMode( Format mode );
252 bool isMissingImage()
const;
261 QString evaluatedPath()
const;
267 QMap<QString, QgsProperty> svgDynamicParameters()
const;
273 void setSvgDynamicParameters(
const QMap<QString, QgsProperty> ¶meters );
282 void setPictureRotation(
double rotation );
301 void recalculateSize();
307 void pictureRotationChanged(
double newRotation );
321 QRectF boundedSVGRect(
double deviceWidth,
double deviceHeight );
323 QRectF boundedImageRect(
double deviceWidth,
double deviceHeight );
326 QSizeF pictureSize();
332 Format mMode = FormatUnknown;
334 QSize mDefaultSvgSize;
337 double mPictureRotation = 0;
339 QString mRotationMapUuid;
342 double mPictureWidth = 0.0;
344 double mPictureHeight = 0.0;
349 QColor mSvgFillColor = QColor( 255, 255, 255 );
350 QColor mSvgStrokeColor = QColor( 0, 0, 0 );
351 double mSvgStrokeWidth = 0.2;
353 bool mHasExpressionError =
false;
354 bool mLoaded =
false;
355 bool mLoadingSvg =
false;
356 bool mIsMissingImage =
false;
357 QString mEvaluatedPath;
362 void loadPicture(
const QVariant &data );
368 QRect clippedImageRect(
double &boundRectWidthMM,
double &boundRectHeightMM, QSize imageRectPixels );
373 void loadRemotePicture(
const QString &url );
378 void loadLocalPicture(
const QString &path );
380 void loadPictureUsingCache(
const QString &path );
387 void updateNorthArrowRotation(
double rotation );
392 friend class TestQgsCompositionConverter;
396 #endif // QGSLAYOUTITEMPICTURE_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual QSizeF applyItemSizeConstraint(QSizeF targetSize)
Applies any item-specific size constraint handling to a given targetSize in layout units.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
The class is used as a container of context for various read/write operations on other objects.
virtual QIcon icon() const
Returns the item's icon.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
Contains settings and helpers relating to a render of a QgsLayoutItem.
NorthMode
Method for syncing rotation to a map's North direction.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QColor svgFillColor() const
Returns the fill color used for parametrized SVG files.
QColor svgStrokeColor() const
Returns the stroke color used for parametrized SVG files.
ReferencePoint
Fixed position reference point.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
QgsLayoutItem::ReferencePoint pictureAnchor() const
Returns the picture's current anchor, which controls how it is placed within the picture item's frame...
int type() const override
Returns a unique graphics item type identifier.
double pictureRotation() const
Returns the rotation used for drawing the picture within the item's frame, in degrees clockwise.
@ AllProperties
All properties for item.
@ Stretch
Stretches image to fit frame, ignores aspect ratio.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
@ ZoomResizeFrame
Enlarges image to fit frame, then resizes frame to fit resultant image.
Format
Format of source image.
@ FormatUnknown
Invalid or unknown image type.
@ Clip
Draws image at original size and clips any portion which falls outside frame.
ResizeMode
Controls how pictures are scaled within the item's frame.
Base class for graphical items within a QgsLayout.
Format mode() const
Returns the current picture mode (image format).
An object which handles north-arrow type behavior for layout items.
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
Layout graphical items for displaying a map.
@ Zoom
Enlarges image to fit frame while maintaining aspect ratio of picture.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
@ TrueNorth
Align to true north.
ResizeMode resizeMode() const
Returns the resize mode used for drawing the picture within the layout item's frame.
@ FormatRaster
Raster image.
double svgStrokeWidth() const
Returns the stroke width (in layout units) used for parametrized SVG files.
Class for parsing and evaluation of expressions (formerly called "search strings")....
@ UpperLeft
Upper left corner of item.
DataDefinedProperty
Data defined properties for different item types.