QGIS API Documentation 3.43.0-Master (c67cf405802)
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
43{
44 public:
45
56 QgsLayoutItemRenderContext( QgsRenderContext &context, double viewScaleFactor = 1.0 );
57
60
67 QgsRenderContext &renderContext() { return mRenderContext; }
68
77 const QgsRenderContext &renderContext() const SIP_SKIP { return mRenderContext; }
78
89 double viewScaleFactor() const { return mViewScaleFactor; }
90
91 private:
92
93#ifdef SIP_RUN
95#endif
96
97 QgsRenderContext &mRenderContext;
98 double mViewScaleFactor = 1.0;
99};
100
106class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectItem, public QgsLayoutUndoObjectInterface
107{
108 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemgroup.h" );
109 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemmap.h" );
110 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitempicture.h" );
111 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemlabel.h" );
112 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemlegend.h" );
113 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitempolygon.h" );
114 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitempolyline.h" );
115 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemscalebar.h" );
116 //SIP_TYPEHEADER_INCLUDE( "qgslayoutframe.h" );
117 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemshape.h" );
118 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitempage.h" );
119 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemmarker.h" );
120 //SIP_TYPEHEADER_INCLUDE( "qgslayoutitemelevationprofile.h" );
121
122#ifdef SIP_RUN
124
125 // FREAKKKKIIN IMPORTANT!!!!!!!!!!!
126 // IF YOU PUT SOMETHING HERE, PUT IT IN QgsLayoutObject CASTING *****ALSO******
127 // (it's not enough for it to be in only one of the places, as sip inconsistently
128 // decides which casting code to perform here)
129
130 // the conversions have to be static, because they're using multiple inheritance
131 // (seen in PyQt4 .sip files for some QGraphicsItem classes)
132 switch ( sipCpp->type() )
133 {
134 // really, these *should* use the constants from QgsLayoutItemRegistry, but sip doesn't like that!
135 case QGraphicsItem::UserType + 101:
136 sipType = sipType_QgsLayoutItemGroup;
137 *sipCppRet = static_cast<QgsLayoutItemGroup *>( sipCpp );
138 break;
139 case QGraphicsItem::UserType + 102:
140 sipType = sipType_QgsLayoutItemPage;
141 *sipCppRet = static_cast<QgsLayoutItemPage *>( sipCpp );
142 break;
143 case QGraphicsItem::UserType + 103:
144 sipType = sipType_QgsLayoutItemMap;
145 *sipCppRet = static_cast<QgsLayoutItemMap *>( sipCpp );
146 break;
147 case QGraphicsItem::UserType + 104:
148 sipType = sipType_QgsLayoutItemPicture;
149 *sipCppRet = static_cast<QgsLayoutItemPicture *>( sipCpp );
150 break;
151 case QGraphicsItem::UserType + 105:
152 sipType = sipType_QgsLayoutItemLabel;
153 *sipCppRet = static_cast<QgsLayoutItemLabel *>( sipCpp );
154 break;
155 case QGraphicsItem::UserType + 106:
156 sipType = sipType_QgsLayoutItemLegend;
157 *sipCppRet = static_cast<QgsLayoutItemLegend *>( sipCpp );
158 break;
159 case QGraphicsItem::UserType + 107:
160 sipType = sipType_QgsLayoutItemShape;
161 *sipCppRet = static_cast<QgsLayoutItemShape *>( sipCpp );
162 break;
163 case QGraphicsItem::UserType + 108:
164 sipType = sipType_QgsLayoutItemPolygon;
165 *sipCppRet = static_cast<QgsLayoutItemPolygon *>( sipCpp );
166 break;
167 case QGraphicsItem::UserType + 109:
168 sipType = sipType_QgsLayoutItemPolyline;
169 *sipCppRet = static_cast<QgsLayoutItemPolyline *>( sipCpp );
170 break;
171 case QGraphicsItem::UserType + 110:
172 sipType = sipType_QgsLayoutItemScaleBar;
173 *sipCppRet = static_cast<QgsLayoutItemScaleBar *>( sipCpp );
174 break;
175 case QGraphicsItem::UserType + 111:
176 sipType = sipType_QgsLayoutFrame;
177 *sipCppRet = static_cast<QgsLayoutFrame *>( sipCpp );
178 break;
179 case QGraphicsItem::UserType + 117:
180 sipType = sipType_QgsLayoutItemMarker;
181 *sipCppRet = static_cast<QgsLayoutItemMarker *>( sipCpp );
182 break;
183 case QGraphicsItem::UserType + 118:
184 sipType = sipType_QgsLayoutItemElevationProfile;
185 *sipCppRet = static_cast<QgsLayoutItemElevationProfile *>( sipCpp );
186 break;
187
188 // did you read that comment above? NO? Go read it now. You're about to break stuff.
189
190 default:
191 sipType = NULL;
192 }
193 SIP_END
194#endif
195
196
197 Q_OBJECT
198 Q_PROPERTY( bool locked READ isLocked WRITE setLocked NOTIFY lockChanged )
199
200 public:
201
215
218 {
219 UndoNone = -1,
220 UndoIncrementalMove = 1,
320
322 };
323
328 enum Flag SIP_ENUM_BASETYPE( IntFlag )
329 {
330 FlagOverridesPaint = 1 << 1,
331 FlagProvidesClipPath = 1 << 2,
332 FlagDisableSceneCaching = 1 << 3,
333 };
334 Q_DECLARE_FLAGS( Flags, Flag )
335
336
342 explicit QgsLayoutItem( QgsLayout *layout, bool manageZValue = true );
343
344 ~QgsLayoutItem() override;
345
350 virtual void cleanup();
351
357 int type() const override;
358
362 virtual QIcon icon() const;
363
371 virtual QString uuid() const { return mUuid; }
372
377 virtual Flags itemFlags() const;
378
385 QString id() const { return mId; }
386
393 virtual void setId( const QString &id );
394
401 virtual QString displayName() const;
402
406 virtual void setSelected( bool selected );
407
414 virtual void setVisibility( bool visible );
415
421 void setLocked( bool locked );
422
428 bool isLocked() const { return mIsLocked; }
429
435 bool isGroupMember() const;
436
442 QgsLayoutItemGroup *parentGroup() const;
443
449 void setParentGroup( QgsLayoutItemGroup *group );
450
462
471 virtual ExportLayerBehavior exportLayerBehavior() const;
472
486 Q_DECL_DEPRECATED virtual int numberExportLayers() const SIP_DEPRECATED;
487
495 virtual void startLayeredExport();
496
504 virtual void stopLayeredExport();
505
513 virtual bool nextExportPart();
514
520 struct CORE_EXPORT ExportLayerDetail
521 {
523 QString name;
524
526 QString mapLayerId;
527
532 QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver;
533
538 double opacity = 1.0;
539
541 QString mapTheme;
542
548 QString groupName;
549 };
550
558 virtual QgsLayoutItem::ExportLayerDetail exportLayerDetails() const;
559
565 void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) override;
566
573 void setReferencePoint( ReferencePoint point );
574
581 ReferencePoint referencePoint() const { return mReferencePoint; }
582
589 virtual QgsLayoutSize fixedSize() const { return mFixedSize; }
590
597 virtual QgsLayoutSize minimumSize() const { return mMinimumSize; }
598
613 virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
614
640 virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false, int page = -1 );
641
657 void attemptSetSceneRect( const QRectF &rect, bool includesFrame = false );
658
671 void attemptMoveBy( double deltaX, double deltaY );
672
681 QgsLayoutPoint positionWithUnits() const { return mItemPosition; }
682
687 int page() const;
688
694 QPointF pagePos() const;
695
701 QgsLayoutPoint pagePositionWithUnits() const;
702
708 QgsLayoutSize sizeWithUnits() const { return mItemSize; }
709
720 double itemRotation() const;
721
729 bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
730
746 bool readXml( const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context );
747
756 virtual void finalizeRestoreFromXml();
757
758 QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
759
767 bool frameEnabled() const { return mFrame; }
768
776 virtual void setFrameEnabled( bool drawFrame );
777
785 void setFrameStrokeColor( const QColor &color );
786
794 QColor frameStrokeColor() const { return mFrameColor; }
795
803 virtual void setFrameStrokeWidth( QgsLayoutMeasurement width );
804
812 QgsLayoutMeasurement frameStrokeWidth() const { return mFrameWidth; }
813
821 Qt::PenJoinStyle frameJoinStyle() const { return mFrameJoinStyle; }
822
830 void setFrameJoinStyle( Qt::PenJoinStyle style );
831
837 bool hasBackground() const { return mBackground; }
838
844 void setBackgroundEnabled( bool drawBackground );
845
853 QColor backgroundColor( bool useDataDefined = true ) const;
854
860 void setBackgroundColor( const QColor &color );
861
866 QPainter::CompositionMode blendMode() const { return mBlendMode; }
867
872 void setBlendMode( QPainter::CompositionMode mode );
873
881 double itemOpacity() const { return mOpacity; }
882
890 void setItemOpacity( double opacity );
891
896 bool excludeFromExports() const;
897
902 void setExcludeFromExports( bool exclude );
903
913 virtual bool containsAdvancedEffects() const;
914
920 virtual bool requiresRasterization() const;
921
932 virtual double estimatedFrameBleed() const;
933
943 virtual QRectF rectWithFrame() const;
944
951 virtual void moveContent( double dx, double dy );
952
959 virtual void setMoveContentPreviewOffset( double dx, double dy );
960
967 virtual void zoomContent( double factor, QPointF point );
968
977 void beginCommand( const QString &commandText, UndoCommand command = UndoNone );
978
984 void endCommand();
985
991 void cancelCommand();
992
996 bool shouldDrawItem() const;
997
998 QgsExpressionContext createExpressionContext() const override;
999
1009 virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
1010
1019 virtual QgsGeometry clipPath() const;
1020
1026 virtual bool isRefreshing() const;
1027
1028 public slots:
1029
1034 void refresh() override;
1035
1039 virtual void invalidateCache();
1040
1044 virtual void redraw();
1045
1052 virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::DataDefinedProperty::AllProperties );
1053
1063 virtual void setItemRotation( double rotation, bool adjustPosition = true );
1064
1070 virtual void rotateItem( double angle, QPointF transformOrigin );
1071
1072 signals:
1073
1078
1085
1089 void rotationChanged( double newRotation );
1090
1095
1102
1111
1112 protected:
1113
1119 virtual void drawDebugRect( QPainter *painter );
1120
1127 virtual void draw( QgsLayoutItemRenderContext &context ) = 0;
1128
1136 virtual QPainterPath framePath() const;
1137
1143 virtual void drawFrame( QgsRenderContext &context );
1144
1150 virtual void drawBackground( QgsRenderContext &context );
1151
1157 void drawRefreshingOverlay( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle );
1158
1165 virtual void setFixedSize( const QgsLayoutSize &size );
1166
1173 virtual void setMinimumSize( const QgsLayoutSize &size );
1174
1183 virtual QSizeF applyItemSizeConstraint( QSizeF targetSize );
1184
1192 void refreshItemSize();
1193
1199 void refreshItemPosition();
1200
1211 void refreshItemRotation( QPointF *origin = nullptr );
1212
1218 void refreshOpacity( bool updateItem = true );
1219
1225 void refreshFrame( bool updateItem = true );
1226
1232 void refreshBackgroundColor( bool updateItem = true );
1233
1237 void refreshBlendMode();
1238
1243 QPointF adjustPointForReferencePosition( QPointF point, QSizeF size, ReferencePoint reference ) const;
1244
1248 QPointF positionAtReferencePoint( ReferencePoint reference ) const;
1249
1254 QgsLayoutPoint topLeftToReferencePoint( const QgsLayoutPoint &point ) const;
1255
1264 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
1265
1281 virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
1282
1286 QgsLayoutSize applyDataDefinedSize( const QgsLayoutSize &size );
1287
1288 private:
1289
1290 // true if layout manages the z value for this item
1291 bool mLayoutManagesZValue = false;
1292
1294 QString mId;
1295
1297 QString mUuid;
1298
1300 QString mTemplateUuid;
1301
1303 QString mParentGroupUuid;
1304
1305 ReferencePoint mReferencePoint = UpperLeft;
1306 QgsLayoutSize mFixedSize;
1307 QgsLayoutSize mMinimumSize;
1308
1309 QgsLayoutSize mItemSize;
1310 QgsLayoutPoint mItemPosition;
1311 double mItemRotation = 0.0;
1312
1314 bool mExcludeFromExports = false;
1315
1320 bool mEvaluatedExcludeFromExports = false;
1321
1323 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1325 QPainter::CompositionMode mEvaluatedBlendMode = QPainter::CompositionMode_SourceOver;
1326
1327 QPainter::CompositionMode blendModeForRender() const;
1328
1330 double mOpacity = 1.0;
1331 double mEvaluatedOpacity = 1.0;
1332
1333 QImage mItemCachedImage;
1334 double mItemCacheDpi = -1;
1335
1336 bool mIsLocked = false;
1337
1339 bool mFrame = false;
1341 QColor mFrameColor = QColor( 0, 0, 0 );
1345 Qt::PenJoinStyle mFrameJoinStyle = Qt::MiterJoin;
1346
1348 bool mBackground = true;
1350 QColor mBackgroundColor = QColor( 255, 255, 255 );
1351
1352 bool mBlockUndoCommands = false;
1353
1354 void initConnectionsToLayout();
1355
1357 void preparePainter( QPainter *painter );
1358 bool shouldDrawAntialiased() const;
1359 bool shouldDrawDebugRect() const;
1360 QSizeF applyMinimumSize( QSizeF targetSize );
1361 QSizeF applyFixedSize( QSizeF targetSize );
1362 QgsLayoutPoint applyDataDefinedPosition( const QgsLayoutPoint &position );
1363
1364 double applyDataDefinedRotation( double rotation );
1365 void updateStoredItemPosition();
1366 QPointF itemPositionAtReferencePoint( ReferencePoint reference, QSizeF size ) const;
1367 void setScenePos( QPointF destinationPos );
1368 bool shouldBlockUndoCommands() const;
1369
1370 void applyDataDefinedOrientation( double &width, double &height, const QgsExpressionContext &context );
1371
1372 friend class TestQgsLayoutItem;
1373 friend class TestQgsLayoutView;
1374 friend class QgsLayout;
1376 friend class QgsLayoutItemMap;
1380};
1381
1383
1384#endif //QGSLAYOUTITEM_H
@ Millimeters
Millimeters.
Base class for commands to undo/redo layout and layout object changes.
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.
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.
QgsLayoutItemRenderContext & operator=(const QgsLayoutItemRenderContext &other)=delete
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
double viewScaleFactor() const
Returns the current view zoom (scale factor).
QgsLayoutItemRenderContext(const QgsLayoutItemRenderContext &other)=delete
const QgsRenderContext & renderContext() const
Returns a reference to the context's render context.
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.
@ 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.
@ UndoExportLayerName
Export layer name.
@ UndoZoomContent
Item content zoomed.
@ UndoScaleBarFontColor
Scalebar font color.
@ UndoElevationProfileMaximumElevation
Change elevation profile maximum elevation.
@ UndoMarginLeft
Left margin.
@ UndoMarginRight
Right margin.
@ 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.
@ 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.
@ UndoElevationProfileSubsectionLines
Change elevation profile subsection indicator symbol.
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.
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.
QFlags< Flag > Flags
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.
Provides a method of storing measurements for use in QGIS layouts using a variety of different measur...
A base class for objects which belong to a layout.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
Provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts.
Provides a method of storing sizes, consisting of a width and height, for use in QGIS layouts.
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:49
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_FORCE
Definition qgis_sip.h:131
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_END
Definition qgis_sip.h:208
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
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 groupName
Associated group name, if this layer is associated with an export group.
QString mapTheme
Associated map theme, or an empty string if this export layer does not need to be associated with a m...