QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgslayoutitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitem.h
3 -------------------
4 begin : June 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSLAYOUTITEM_H
18#define QGSLAYOUTITEM_H
19
20#include "qgis_core.h"
21#include "qgslayoutobject.h"
22#include "qgslayoutsize.h"
23#include "qgslayoutpoint.h"
24#include "qgsrendercontext.h"
27#include <QGraphicsRectItem>
28#include <QIcon>
29#include <QPainter>
30
31class QgsLayout;
32class QPainter;
34class QgsLayoutEffect;
36
44{
45 public:
46
57 QgsLayoutItemRenderContext( QgsRenderContext &context, double viewScaleFactor = 1.0 );
58
61
64
71 QgsRenderContext &renderContext() { return mRenderContext; }
72
81 const QgsRenderContext &renderContext() const { return mRenderContext; } SIP_SKIP
82
93 double viewScaleFactor() const { return mViewScaleFactor; }
94
95 private:
96
97#ifdef SIP_RUN
99#endif
100
101 QgsRenderContext &mRenderContext;
102 double mViewScaleFactor = 1.0;
103};
104
111class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectItem, public QgsLayoutUndoObjectInterface
112{
113#ifdef SIP_RUN
114#include "qgslayoutitemgroup.h"
115#include "qgslayoutitemmap.h"
116#include "qgslayoutitempicture.h"
117#include "qgslayoutitemlabel.h"
118#include "qgslayoutitemlegend.h"
119#include "qgslayoutitempolygon.h"
122#include "qgslayoutframe.h"
123#include "qgslayoutitemshape.h"
124#include "qgslayoutitempage.h"
125#include "qgslayoutitemmarker.h"
127#endif
128
129#ifdef SIP_RUN
131
132 // FREAKKKKIIN IMPORTANT!!!!!!!!!!!
133 // IF YOU PUT SOMETHING HERE, PUT IT IN QgsLayoutObject CASTING *****ALSO******
134 // (it's not enough for it to be in only one of the places, as sip inconsistently
135 // decides which casting code to perform here)
136
137 // the conversions have to be static, because they're using multiple inheritance
138 // (seen in PyQt4 .sip files for some QGraphicsItem classes)
139 switch ( sipCpp->type() )
140 {
141 // really, these *should* use the constants from QgsLayoutItemRegistry, but sip doesn't like that!
142 case QGraphicsItem::UserType + 101:
143 sipType = sipType_QgsLayoutItemGroup;
144 *sipCppRet = static_cast<QgsLayoutItemGroup *>( sipCpp );
145 break;
146 case QGraphicsItem::UserType + 102:
147 sipType = sipType_QgsLayoutItemPage;
148 *sipCppRet = static_cast<QgsLayoutItemPage *>( sipCpp );
149 break;
150 case QGraphicsItem::UserType + 103:
151 sipType = sipType_QgsLayoutItemMap;
152 *sipCppRet = static_cast<QgsLayoutItemMap *>( sipCpp );
153 break;
154 case QGraphicsItem::UserType + 104:
155 sipType = sipType_QgsLayoutItemPicture;
156 *sipCppRet = static_cast<QgsLayoutItemPicture *>( sipCpp );
157 break;
158 case QGraphicsItem::UserType + 105:
159 sipType = sipType_QgsLayoutItemLabel;
160 *sipCppRet = static_cast<QgsLayoutItemLabel *>( sipCpp );
161 break;
162 case QGraphicsItem::UserType + 106:
163 sipType = sipType_QgsLayoutItemLegend;
164 *sipCppRet = static_cast<QgsLayoutItemLegend *>( sipCpp );
165 break;
166 case QGraphicsItem::UserType + 107:
167 sipType = sipType_QgsLayoutItemShape;
168 *sipCppRet = static_cast<QgsLayoutItemShape *>( sipCpp );
169 break;
170 case QGraphicsItem::UserType + 108:
171 sipType = sipType_QgsLayoutItemPolygon;
172 *sipCppRet = static_cast<QgsLayoutItemPolygon *>( sipCpp );
173 break;
174 case QGraphicsItem::UserType + 109:
175 sipType = sipType_QgsLayoutItemPolyline;
176 *sipCppRet = static_cast<QgsLayoutItemPolyline *>( sipCpp );
177 break;
178 case QGraphicsItem::UserType + 110:
179 sipType = sipType_QgsLayoutItemScaleBar;
180 *sipCppRet = static_cast<QgsLayoutItemScaleBar *>( sipCpp );
181 break;
182 case QGraphicsItem::UserType + 111:
183 sipType = sipType_QgsLayoutFrame;
184 *sipCppRet = static_cast<QgsLayoutFrame *>( sipCpp );
185 break;
186 case QGraphicsItem::UserType + 117:
187 sipType = sipType_QgsLayoutItemMarker;
188 *sipCppRet = static_cast<QgsLayoutItemMarker *>( sipCpp );
189 break;
190 case QGraphicsItem::UserType + 118:
191 sipType = sipType_QgsLayoutItemElevationProfile;
192 *sipCppRet = static_cast<QgsLayoutItemElevationProfile *>( sipCpp );
193 break;
194
195 // did you read that comment above? NO? Go read it now. You're about to break stuff.
196
197 default:
198 sipType = NULL;
199 }
200 SIP_END
201#endif
202
203
204 Q_OBJECT
205 Q_PROPERTY( bool locked READ isLocked WRITE setLocked NOTIFY lockChanged )
206
207 public:
208
211 {
221 };
222
225 {
226 UndoNone = -1,
227 UndoIncrementalMove = 1,
325
327 };
328
333 enum Flag
334 {
335 FlagOverridesPaint = 1 << 1,
336 FlagProvidesClipPath = 1 << 2,
337 };
338 Q_DECLARE_FLAGS( Flags, Flag )
339
340
346 explicit QgsLayoutItem( QgsLayout *layout, bool manageZValue = true );
347
348 ~QgsLayoutItem() override;
349
354 virtual void cleanup();
355
361 int type() const override;
362
366 virtual QIcon icon() const;
367
375 virtual QString uuid() const { return mUuid; }
376
381 virtual Flags itemFlags() const;
382
389 QString id() const { return mId; }
390
397 virtual void setId( const QString &id );
398
405 virtual QString displayName() const;
406
410 virtual void setSelected( bool selected );
411
418 virtual void setVisibility( bool visible );
419
425 void setLocked( bool locked );
426
432 bool isLocked() const { return mIsLocked; }
433
439 bool isGroupMember() const;
440
446 QgsLayoutItemGroup *parentGroup() const;
447
453 void setParentGroup( QgsLayoutItemGroup *group );
454
460 {
465 };
466
473 virtual ExportLayerBehavior exportLayerBehavior() const;
474
488 Q_DECL_DEPRECATED virtual int numberExportLayers() const SIP_DEPRECATED;
489
497 virtual void startLayeredExport();
498
506 virtual void stopLayeredExport();
507
515 virtual bool nextExportPart();
516
522 struct CORE_EXPORT ExportLayerDetail
523 {
525 QString name;
526
528 QString mapLayerId;
529
534 QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver;
535
540 double opacity = 1.0;
541
543 QString mapTheme;
544 };
545
553 virtual QgsLayoutItem::ExportLayerDetail exportLayerDetails() const;
554
560 void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) override;
561
568 void setReferencePoint( ReferencePoint point );
569
576 ReferencePoint referencePoint() const { return mReferencePoint; }
577
584 virtual QgsLayoutSize fixedSize() const { return mFixedSize; }
585
592 virtual QgsLayoutSize minimumSize() const { return mMinimumSize; }
593
608 virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
609
635 virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false, int page = -1 );
636
652 void attemptSetSceneRect( const QRectF &rect, bool includesFrame = false );
653
666 void attemptMoveBy( double deltaX, double deltaY );
667
676 QgsLayoutPoint positionWithUnits() const { return mItemPosition; }
677
682 int page() const;
683
689 QPointF pagePos() const;
690
696 QgsLayoutPoint pagePositionWithUnits() const;
697
703 QgsLayoutSize sizeWithUnits() const { return mItemSize; }
704
715 double itemRotation() const;
716
724 bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
725
741 bool readXml( const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context );
742
751 virtual void finalizeRestoreFromXml();
752
753 QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
754
762 bool frameEnabled() const { return mFrame; }
763
771 virtual void setFrameEnabled( bool drawFrame );
772
780 void setFrameStrokeColor( const QColor &color );
781
789 QColor frameStrokeColor() const { return mFrameColor; }
790
798 virtual void setFrameStrokeWidth( QgsLayoutMeasurement width );
799
807 QgsLayoutMeasurement frameStrokeWidth() const { return mFrameWidth; }
808
816 Qt::PenJoinStyle frameJoinStyle() const { return mFrameJoinStyle; }
817
825 void setFrameJoinStyle( Qt::PenJoinStyle style );
826
832 bool hasBackground() const { return mBackground; }
833
839 void setBackgroundEnabled( bool drawBackground );
840
847 QColor backgroundColor() const { return mBackgroundColor; }
848
854 void setBackgroundColor( const QColor &color );
855
860 QPainter::CompositionMode blendMode() const { return mBlendMode; }
861
866 void setBlendMode( QPainter::CompositionMode mode );
867
875 double itemOpacity() const { return mOpacity; }
876
884 void setItemOpacity( double opacity );
885
890 bool excludeFromExports() const;
891
896 void setExcludeFromExports( bool exclude );
897
907 virtual bool containsAdvancedEffects() const;
908
914 virtual bool requiresRasterization() const;
915
926 virtual double estimatedFrameBleed() const;
927
937 virtual QRectF rectWithFrame() const;
938
945 virtual void moveContent( double dx, double dy );
946
953 virtual void setMoveContentPreviewOffset( double dx, double dy );
954
961 virtual void zoomContent( double factor, QPointF point );
962
971 void beginCommand( const QString &commandText, UndoCommand command = UndoNone );
972
978 void endCommand();
979
985 void cancelCommand();
986
990 bool shouldDrawItem() const;
991
992 QgsExpressionContext createExpressionContext() const override;
993
1003 virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
1004
1013 virtual QgsGeometry clipPath() const;
1014
1015 public slots:
1016
1021 void refresh() override;
1022
1026 virtual void invalidateCache();
1027
1031 virtual void redraw();
1032
1039 virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
1040
1050 virtual void setItemRotation( double rotation, bool adjustPosition = true );
1051
1057 virtual void rotateItem( double angle, QPointF transformOrigin );
1058
1059 signals:
1060
1065
1072
1076 void rotationChanged( double newRotation );
1077
1082
1089
1098
1099 protected:
1100
1106 virtual void drawDebugRect( QPainter *painter );
1107
1114 virtual void draw( QgsLayoutItemRenderContext &context ) = 0;
1115
1123 virtual QPainterPath framePath() const;
1124
1130 virtual void drawFrame( QgsRenderContext &context );
1131
1137 virtual void drawBackground( QgsRenderContext &context );
1138
1145 virtual void setFixedSize( const QgsLayoutSize &size );
1146
1153 virtual void setMinimumSize( const QgsLayoutSize &size );
1154
1163 virtual QSizeF applyItemSizeConstraint( QSizeF targetSize );
1164
1172 void refreshItemSize();
1173
1179 void refreshItemPosition();
1180
1191 void refreshItemRotation( QPointF *origin = nullptr );
1192
1198 void refreshOpacity( bool updateItem = true );
1199
1205 void refreshFrame( bool updateItem = true );
1206
1212 void refreshBackgroundColor( bool updateItem = true );
1213
1217 void refreshBlendMode();
1218
1223 QPointF adjustPointForReferencePosition( QPointF point, QSizeF size, ReferencePoint reference ) const;
1224
1228 QPointF positionAtReferencePoint( ReferencePoint reference ) const;
1229
1234 QgsLayoutPoint topLeftToReferencePoint( const QgsLayoutPoint &point ) const;
1235
1244 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
1245
1261 virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
1262
1266 QgsLayoutSize applyDataDefinedSize( const QgsLayoutSize &size );
1267
1268 private:
1269
1270 // true if layout manages the z value for this item
1271 bool mLayoutManagesZValue = false;
1272
1274 QString mId;
1275
1277 QString mUuid;
1278
1280 QString mTemplateUuid;
1281
1283 QString mParentGroupUuid;
1284
1285 ReferencePoint mReferencePoint = UpperLeft;
1286 QgsLayoutSize mFixedSize;
1287 QgsLayoutSize mMinimumSize;
1288
1289 QgsLayoutSize mItemSize;
1290 QgsLayoutPoint mItemPosition;
1291 double mItemRotation = 0.0;
1292
1294 bool mExcludeFromExports = false;
1295
1300 bool mEvaluatedExcludeFromExports = false;
1301
1303 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1304 std::unique_ptr< QgsLayoutEffect > mEffect;
1305
1307 double mOpacity = 1.0;
1308 double mEvaluatedOpacity = 1.0;
1309
1310 QImage mItemCachedImage;
1311 double mItemCacheDpi = -1;
1312
1313 bool mIsLocked = false;
1314
1316 bool mFrame = false;
1318 QColor mFrameColor = QColor( 0, 0, 0 );
1320 QgsLayoutMeasurement mFrameWidth = QgsLayoutMeasurement( 0.3, Qgis::LayoutUnit::Millimeters );
1322 Qt::PenJoinStyle mFrameJoinStyle = Qt::MiterJoin;
1323
1325 bool mBackground = true;
1327 QColor mBackgroundColor = QColor( 255, 255, 255 );
1328
1329 bool mBlockUndoCommands = false;
1330
1331 void initConnectionsToLayout();
1332
1334 void preparePainter( QPainter *painter );
1335 bool shouldDrawAntialiased() const;
1336 bool shouldDrawDebugRect() const;
1337 QSizeF applyMinimumSize( QSizeF targetSize );
1338 QSizeF applyFixedSize( QSizeF targetSize );
1339 QgsLayoutPoint applyDataDefinedPosition( const QgsLayoutPoint &position );
1340
1341 double applyDataDefinedRotation( double rotation );
1342 void updateStoredItemPosition();
1343 QPointF itemPositionAtReferencePoint( ReferencePoint reference, QSizeF size ) const;
1344 void setScenePos( QPointF destinationPos );
1345 bool shouldBlockUndoCommands() const;
1346
1347 void applyDataDefinedOrientation( double &width, double &height, const QgsExpressionContext &context );
1348
1349 friend class TestQgsLayoutItem;
1350 friend class TestQgsLayoutView;
1351 friend class QgsLayout;
1354};
1355
1356Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayoutItem::Flags )
1357
1358#endif //QGSLAYOUTITEM_H
1359
1360
1361
Base class for commands to undo/redo layout and layout object changes.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:164
A QGraphicsEffect subclass used for rendering layout items onto a scene with custom composition modes...
Base class for frame items, which form a layout multiframe item.
A layout item subclass for elevation profile plots.
A container for grouping several QgsLayoutItems.
A layout item subclass for text labels.
A layout item subclass for map legends.
Layout graphical items for displaying a map.
A layout item for showing marker symbols.
Item representing the paper in a layout.
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
Layout item for node based polygon shapes.
Layout item for node based polyline shapes.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Definition: qgslayoutitem.h:44
QgsLayoutItemRenderContext & operator=(const QgsLayoutItemRenderContext &other)=delete
QgsLayoutItemRenderContext cannot be copied.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Definition: qgslayoutitem.h:71
double viewScaleFactor() const
Returns the current view zoom (scale factor).
Definition: qgslayoutitem.h:93
QgsLayoutItemRenderContext(const QgsLayoutItemRenderContext &other)=delete
QgsLayoutItemRenderContext cannot be copied.
const QgsRenderContext & renderContext() const
Returns a reference to the context's render context.
Definition: qgslayoutitem.h:81
A layout item subclass for scale bars.
Layout item for basic filled shapes (e.g.
Base class for graphical items within a QgsLayout.
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
UndoCommand
Layout item undo commands, used for collapsing undo commands.
@ UndoScaleBarSubdivisionsHeight
Scalebar subdivisions height.
@ UndoPictureStrokeWidth
Picture stroke width.
@ UndoLegendMinSymbolSize
Legend minimum symbol size.
@ UndoArrowHeadStrokeColor
Arrow head stroke color.
@ UndoLegendTitleSpaceBottom
Legend title space.
@ UndoScaleBarLabelBarSize
Scalebar label bar size.
@ UndoLegendIconSymbolSpace
Legend icon symbol space.
@ UndoLegendLayerFont
Legend layer font.
@ UndoShapeCornerRadius
Shape corner radius.
@ UndoLegendLineSpacing
Legend line spacing.
@ UndoLegendBoxSpace
Legend box space.
@ UndoScaleBarFillColor
Scalebar fill color.
@ UndoArrowHeadFillColor
Arrow head fill color.
@ UndoLegendRasterStrokeColor
Legend raster stroke color.
@ UndoLabelFontColor
Label color.
@ UndoScaleBarMapUnitsSegment
Scalebar map units per segment.
@ UndoElevationProfileElevationMajorGridlines
Change elevation profile elevation axis major gridlines.
@ UndoLegendTitleFont
Legend title font.
@ UndoBackgroundColor
Background color adjustment.
@ UndoLegendFontColor
Legend font color.
@ UndoElevationProfileMaximumDistance
Change elevation profile maximum distance.
@ UndoScaleBarBoxContentSpace
Scalebar box context space.
@ UndoOverviewStyle
Map overview style.
@ UndoElevationProfileChartBackground
Change elevation profile chart background.
@ UndoGridFramePenColor
Map grid frame pen color.
@ UndoMapRotation
Map rotation changed.
@ UndoOpacity
Opacity adjustment.
@ UndoIncrementalResize
Incremental resize.
@ UndoArrowHeadWidth
Arrow head width.
@ UndoElevationProfileDistanceMinorGridlines
Change elevation profile distance axis minor gridlines.
@ UndoScaleBarSegmentSize
Scalebar segment size.
@ UndoMarginTop
Top margin (since QGIS 3.30)
@ UndoLegendItemFont
Legend item font.
@ UndoLegendWmsLegendWidth
Legend WMS width.
@ UndoMapGridIntervalRange
Grid interval range.
@ UndoLegendLayerSpace
Legend layer spacing.
@ UndoLabelMargin
Label margin.
@ UndoRotation
Rotation adjustment.
@ UndoLegendColumnSpace
Legend column space.
@ UndoPictureRotation
Picture rotation.
@ UndoStrokeWidth
Stroke width adjustment.
@ UndoScaleBarFillColor2
Scalebar secondary fill color.
@ UndoScaleBarHeight
Scalebar height.
@ UndoLegendMaxSymbolSize
Legend maximum symbol size.
@ UndoArrowStrokeWidth
Arrow stroke width.
@ UndoElevationProfileChartBorder
Change elevation profile chart border.
@ UndoMapGridLineSymbol
Grid line symbol.
@ UndoZoomContent
Item content zoomed.
@ UndoScaleBarFontColor
Scalebar font color.
@ UndoElevationProfileMaximumElevation
Change elevation profile maximum elevation.
@ UndoMarginLeft
Left margin (since QGIS 3.30)
@ UndoMarginRight
Right margin (since QGIS 3.30)
@ UndoMapGridMarkerSymbol
Grid marker symbol.
@ UndoAtlasMargin
Map atlas margin changed.
@ UndoPictureFillColor
Picture fill color.
@ UndoLegendSymbolSpace
Legend symbol spacing.
@ UndoMapGridFrameFill1Color
Map grid frame fill color 1.
@ UndoElevationProfileTolerance
Change elevation profile distance tolerance.
@ UndoElevationProfileElevationFormat
Change elevation profile elevation axis number format.
@ UndoLegendSymbolWidth
Legend symbol width.
@ UndoLegendColumnCount
Legend column count.
@ UndoScaleBarSegments
Scalebar number of segments.
@ UndoLegendSymbolHeight
Legend symbol height.
@ UndoElevationProfileMinimumElevation
Change elevation profile minimum elevation.
@ UndoElevationProfileDistanceLabels
Change elevation profile distance axis label interval.
@ UndoLegendGroupSpace
Legend group spacing.
@ UndoScaleBarSubdivisions
Scalebar number of subdivisions.
@ UndoMarginBottom
Bottom margin (since QGIS 3.30)
@ UndoSetId
Change item ID.
@ UndoLegendSubgroupIndent
Legend subgroup indent.
@ UndoScaleBarLineWidth
Scalebar line width.
@ UndoElevationProfileElevationFont
Change elevation profile elevation axis number font.
@ UndoLegendRasterStrokeWidth
Legend raster stroke width.
@ UndoLegendGroupIndent
Legend group indent.
@ UndoElevationProfileDistanceFormat
Change elevation profile distance axis number format.
@ UndoMapGridAnnotationFontColor
Map frame annotation color.
@ UndoPictureNorthOffset
Picture north offset.
@ UndoElevationProfileElevationMinorGridlines
Change elevation profile elevation axis minor gridlines.
@ UndoCustomCommand
Base id for plugin based item undo commands.
@ UndoLabelFont
Label font.
@ UndoPictureStrokeColor
Picture stroke color.
@ UndoElevationProfileDistanceFont
Change elevation profile distance axis number font.
@ UndoMapAnnotationDistance
Map frame annotation distance.
@ UndoScaleBarStrokeColor
Scalebar stroke color.
@ UndoShapeStyle
Shape symbol style.
@ UndoStrokeColor
Stroke color adjustment.
@ UndoElevationProfileElevationLabels
Change elevation profile elevation axis label interval.
@ UndoScaleBarSegmentsLeft
Scalebar segments left.
@ UndoElevationProfileDistanceMajorGridlines
Change elevation profile distance axis major gridlines.
@ UndoLegendText
Legend text.
@ UndoNodeMove
Node move.
@ UndoMapGridFrameFill2Color
Map grid frame fill color 2.
@ UndoScaleBarUnitText
Scalebar unit text.
@ UndoMapLabelMargin
Margin for labels from edge of map.
@ UndoLegendWmsLegendHeight
Legend WMS height.
@ UndoElevationProfileMinimumDistance
Change elevation profile minimum distance.
@ UndoLabelText
Label text.
@ UndoLegendGroupFont
Legend group font.
void rotationChanged(double newRotation)
Emitted on item rotation change.
QgsLayoutMeasurement frameStrokeWidth() const
Returns the frame's stroke width.
bool isLocked() const
Returns true if the item is locked, and cannot be interacted with using the mouse.
double itemOpacity() const
Returns the item's opacity.
ReferencePoint referencePoint() const
Returns the reference point for positioning of the layout item.
QgsLayoutPoint positionWithUnits() const
Returns the item's current position, including units.
ReferencePoint
Fixed position reference point.
@ LowerMiddle
Lower center of item.
@ MiddleLeft
Middle left of item.
@ Middle
Center of item.
@ UpperRight
Upper right corner of item.
@ LowerLeft
Lower left corner of item.
@ UpperLeft
Upper left corner of item.
@ UpperMiddle
Upper center of item.
@ MiddleRight
Middle right of item.
@ LowerRight
Lower right corner of item.
QColor backgroundColor() const
Returns the background color for this item.
virtual QgsLayoutSize minimumSize() const
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely r...
Flag
Flags for controlling how an item behaves.
virtual QgsLayoutSize fixedSize() const
Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized.
void sizePositionChanged()
Emitted when the item's size or position changes.
void lockChanged()
Emitted if the item's lock status changes.
virtual QString uuid() const
Returns the item identification string.
QString id() const
Returns the item's ID name.
void frameChanged()
Emitted if the item's frame style changes.
ExportLayerBehavior
Behavior of item when exporting to layered outputs.
@ ItemContainsSubLayers
Item contains multiple sublayers which must be individually exported.
@ MustPlaceInOwnLayer
Item must be placed in its own individual layer.
@ CanGroupWithItemsOfSameType
Item can only be placed on layers with other items of the same type, but multiple items of this type ...
@ CanGroupWithAnyOtherItem
Item can be placed on a layer with any other item (default behavior)
void clipPathChanged()
Emitted when the item's clipping path has changed.
bool hasBackground() const
Returns true if the item has a background.
QColor frameStrokeColor() const
Returns the frame's stroke color.
QPainter::CompositionMode blendMode() const
Returns the item's composition blending mode.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
void backgroundTaskCountChanged(int count)
Emitted whenever the number of background tasks an item is executing changes.
Qt::PenJoinStyle frameJoinStyle() const
Returns the join style used for drawing the item's frame.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
A base class for objects which belong to a layout.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
This class provides a method of storing points, consisting of an x and y coordinate,...
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
Definition: qgslayoutsize.h:41
Interface for layout objects which support undo/redo commands.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_FORCE
Definition: qgis_sip.h:131
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:203
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
Contains details of a particular export layer relating to a layout item.
QString mapLayerId
Associated map layer ID, or an empty string if this export layer is not associated with a map layer.
QString name
User-friendly name for the export layer.
QString mapTheme
Associated map theme, or an empty string if this export layer does not need to be associated with a m...