QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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"
25 #include "qgslayoutundocommand.h"
26 #include "qgslayoutmeasurement.h"
27 #include "qgsapplication.h"
28 #include <QGraphicsRectItem>
29 #include <QIcon>
30 #include <QPainter>
31 
32 class QgsLayout;
33 class QPainter;
34 class QgsLayoutItemGroup;
35 class QgsLayoutEffect;
37 
44 class CORE_EXPORT QgsLayoutItemRenderContext
45 {
46  public:
47 
58  QgsLayoutItemRenderContext( QgsRenderContext &context, double viewScaleFactor = 1.0 );
59 
62 
65 
72  QgsRenderContext &renderContext() { return mRenderContext; }
73 
82  const QgsRenderContext &renderContext() const { return mRenderContext; } SIP_SKIP
83 
94  double viewScaleFactor() const { return mViewScaleFactor; }
95 
96  private:
97 
98 #ifdef SIP_RUN
100 #endif
101 
102  QgsRenderContext &mRenderContext;
103  double mViewScaleFactor = 1.0;
104 };
105 
112 class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectItem, public QgsLayoutUndoObjectInterface
113 {
114 #ifdef SIP_RUN
115 #include "qgslayoutitemgroup.h"
116 #include "qgslayoutitemmap.h"
117 #include "qgslayoutitempicture.h"
118 #include "qgslayoutitemlabel.h"
119 #include "qgslayoutitemlegend.h"
120 #include "qgslayoutitempolygon.h"
121 #include "qgslayoutitempolyline.h"
122 #include "qgslayoutitemscalebar.h"
123 #include "qgslayoutframe.h"
124 #include "qgslayoutitemshape.h"
125 #include "qgslayoutitempage.h"
126 #endif
127 
128 #ifdef SIP_RUN
130 
131  // FREAKKKKIIN IMPORTANT!!!!!!!!!!!
132  // IF YOU PUT SOMETHING HERE, PUT IT IN QgsLayoutObject CASTING *****ALSO******
133  // (it's not enough for it to be in only one of the places, as sip inconsistently
134  // decides which casting code to perform here)
135 
136  // the conversions have to be static, because they're using multiple inheritance
137  // (seen in PyQt4 .sip files for some QGraphicsItem classes)
138  switch ( sipCpp->type() )
139  {
140  // really, these *should* use the constants from QgsLayoutItemRegistry, but sip doesn't like that!
141  case QGraphicsItem::UserType + 101:
142  sipType = sipType_QgsLayoutItemGroup;
143  *sipCppRet = static_cast<QgsLayoutItemGroup *>( sipCpp );
144  break;
145  case QGraphicsItem::UserType + 102:
146  sipType = sipType_QgsLayoutItemPage;
147  *sipCppRet = static_cast<QgsLayoutItemPage *>( sipCpp );
148  break;
149  case QGraphicsItem::UserType + 103:
150  sipType = sipType_QgsLayoutItemMap;
151  *sipCppRet = static_cast<QgsLayoutItemMap *>( sipCpp );
152  break;
153  case QGraphicsItem::UserType + 104:
154  sipType = sipType_QgsLayoutItemPicture;
155  *sipCppRet = static_cast<QgsLayoutItemPicture *>( sipCpp );
156  break;
157  case QGraphicsItem::UserType + 105:
158  sipType = sipType_QgsLayoutItemLabel;
159  *sipCppRet = static_cast<QgsLayoutItemLabel *>( sipCpp );
160  break;
161  case QGraphicsItem::UserType + 106:
162  sipType = sipType_QgsLayoutItemLegend;
163  *sipCppRet = static_cast<QgsLayoutItemLegend *>( sipCpp );
164  break;
165  case QGraphicsItem::UserType + 107:
166  sipType = sipType_QgsLayoutItemShape;
167  *sipCppRet = static_cast<QgsLayoutItemShape *>( sipCpp );
168  break;
169  case QGraphicsItem::UserType + 108:
170  sipType = sipType_QgsLayoutItemPolygon;
171  *sipCppRet = static_cast<QgsLayoutItemPolygon *>( sipCpp );
172  break;
173  case QGraphicsItem::UserType + 109:
174  sipType = sipType_QgsLayoutItemPolyline;
175  *sipCppRet = static_cast<QgsLayoutItemPolyline *>( sipCpp );
176  break;
177  case QGraphicsItem::UserType + 110:
178  sipType = sipType_QgsLayoutItemScaleBar;
179  *sipCppRet = static_cast<QgsLayoutItemScaleBar *>( sipCpp );
180  break;
181  case QGraphicsItem::UserType + 111:
182  sipType = sipType_QgsLayoutFrame;
183  *sipCppRet = static_cast<QgsLayoutFrame *>( sipCpp );
184  break;
185 
186  // did you read that comment above? NO? Go read it now. You're about to break stuff.
187 
188  default:
189  sipType = NULL;
190  }
191  SIP_END
192 #endif
193 
194 
195  Q_OBJECT
196  Q_PROPERTY( bool locked READ isLocked WRITE setLocked NOTIFY lockChanged )
197 
198  public:
199 
202  {
212  };
213 
216  {
217  UndoNone = -1,
218  UndoIncrementalMove = 1,
295 
297  };
298 
303  enum Flag
304  {
305  FlagOverridesPaint = 1 << 1,
306  FlagProvidesClipPath = 1 << 2,
307  };
308  Q_DECLARE_FLAGS( Flags, Flag )
309 
310 
316  explicit QgsLayoutItem( QgsLayout *layout, bool manageZValue = true );
317 
318  ~QgsLayoutItem() override;
319 
324  virtual void cleanup();
325 
331  int type() const override;
332 
336  virtual QIcon icon() const { return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItem.svg" ) ); }
337 
345  virtual QString uuid() const { return mUuid; }
346 
351  virtual Flags itemFlags() const;
352 
359  QString id() const { return mId; }
360 
367  virtual void setId( const QString &id );
368 
375  virtual QString displayName() const;
376 
380  virtual void setSelected( bool selected );
381 
388  virtual void setVisibility( bool visible );
389 
395  void setLocked( bool locked );
396 
402  bool isLocked() const { return mIsLocked; }
403 
409  bool isGroupMember() const;
410 
416  QgsLayoutItemGroup *parentGroup() const;
417 
423  void setParentGroup( QgsLayoutItemGroup *group );
424 
430  {
435  };
436 
443  virtual ExportLayerBehavior exportLayerBehavior() const;
444 
458  Q_DECL_DEPRECATED virtual int numberExportLayers() const SIP_DEPRECATED;
459 
467  virtual void startLayeredExport();
468 
476  virtual void stopLayeredExport();
477 
485  virtual bool nextExportPart();
486 
492  struct CORE_EXPORT ExportLayerDetail
493  {
495  QString name;
496 
498  QString mapLayerId;
499 
504  QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver;
505 
510  double opacity = 1.0;
511 
513  QString mapTheme;
514  };
515 
523  virtual QgsLayoutItem::ExportLayerDetail exportLayerDetails() const;
524 
530  void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) override;
531 
538  void setReferencePoint( ReferencePoint point );
539 
546  ReferencePoint referencePoint() const { return mReferencePoint; }
547 
554  virtual QgsLayoutSize fixedSize() const { return mFixedSize; }
555 
562  virtual QgsLayoutSize minimumSize() const { return mMinimumSize; }
563 
578  virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
579 
605  virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false, int page = -1 );
606 
622  void attemptSetSceneRect( const QRectF &rect, bool includesFrame = false );
623 
636  void attemptMoveBy( double deltaX, double deltaY );
637 
646  QgsLayoutPoint positionWithUnits() const { return mItemPosition; }
647 
652  int page() const;
653 
659  QPointF pagePos() const;
660 
666  QgsLayoutPoint pagePositionWithUnits() const;
667 
673  QgsLayoutSize sizeWithUnits() const { return mItemSize; }
674 
685  double itemRotation() const;
686 
694  bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
695 
711  bool readXml( const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context );
712 
721  virtual void finalizeRestoreFromXml();
722 
723  QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
724 
732  bool frameEnabled() const { return mFrame; }
733 
741  virtual void setFrameEnabled( bool drawFrame );
742 
750  void setFrameStrokeColor( const QColor &color );
751 
759  QColor frameStrokeColor() const { return mFrameColor; }
760 
768  virtual void setFrameStrokeWidth( QgsLayoutMeasurement width );
769 
777  QgsLayoutMeasurement frameStrokeWidth() const { return mFrameWidth; }
778 
786  Qt::PenJoinStyle frameJoinStyle() const { return mFrameJoinStyle; }
787 
795  void setFrameJoinStyle( Qt::PenJoinStyle style );
796 
802  bool hasBackground() const { return mBackground; }
803 
809  void setBackgroundEnabled( bool drawBackground );
810 
817  QColor backgroundColor() const { return mBackgroundColor; }
818 
824  void setBackgroundColor( const QColor &color );
825 
830  QPainter::CompositionMode blendMode() const { return mBlendMode; }
831 
836  void setBlendMode( QPainter::CompositionMode mode );
837 
845  double itemOpacity() const { return mOpacity; }
846 
854  void setItemOpacity( double opacity );
855 
860  bool excludeFromExports() const;
861 
866  void setExcludeFromExports( bool exclude );
867 
877  virtual bool containsAdvancedEffects() const;
878 
884  virtual bool requiresRasterization() const;
885 
896  virtual double estimatedFrameBleed() const;
897 
907  virtual QRectF rectWithFrame() const;
908 
915  virtual void moveContent( double dx, double dy );
916 
923  virtual void setMoveContentPreviewOffset( double dx, double dy );
924 
931  virtual void zoomContent( double factor, QPointF point );
932 
941  void beginCommand( const QString &commandText, UndoCommand command = UndoNone );
942 
948  void endCommand();
949 
955  void cancelCommand();
956 
960  bool shouldDrawItem() const;
961 
962  QgsExpressionContext createExpressionContext() const override;
963 
973  virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
974 
983  virtual QgsGeometry clipPath() const;
984 
985  public slots:
986 
991  void refresh() override;
992 
996  virtual void invalidateCache();
997 
1001  virtual void redraw();
1002 
1009  virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
1010 
1020  virtual void setItemRotation( double rotation, bool adjustPosition = true );
1021 
1027  virtual void rotateItem( double angle, QPointF transformOrigin );
1028 
1029  signals:
1030 
1035 
1041  void lockChanged();
1042 
1046  void rotationChanged( double newRotation );
1047 
1052 
1058  void backgroundTaskCountChanged( int count );
1059 
1068 
1069  protected:
1070 
1076  virtual void drawDebugRect( QPainter *painter );
1077 
1084  virtual void draw( QgsLayoutItemRenderContext &context ) = 0;
1085 
1093  virtual QPainterPath framePath() const;
1094 
1100  virtual void drawFrame( QgsRenderContext &context );
1101 
1107  virtual void drawBackground( QgsRenderContext &context );
1108 
1115  virtual void setFixedSize( const QgsLayoutSize &size );
1116 
1123  virtual void setMinimumSize( const QgsLayoutSize &size );
1124 
1133  virtual QSizeF applyItemSizeConstraint( QSizeF targetSize );
1134 
1142  void refreshItemSize();
1143 
1149  void refreshItemPosition();
1150 
1161  void refreshItemRotation( QPointF *origin = nullptr );
1162 
1168  void refreshOpacity( bool updateItem = true );
1169 
1175  void refreshFrame( bool updateItem = true );
1176 
1182  void refreshBackgroundColor( bool updateItem = true );
1183 
1187  void refreshBlendMode();
1188 
1193  QPointF adjustPointForReferencePosition( QPointF point, QSizeF size, ReferencePoint reference ) const;
1194 
1198  QPointF positionAtReferencePoint( ReferencePoint reference ) const;
1199 
1204  QgsLayoutPoint topLeftToReferencePoint( const QgsLayoutPoint &point ) const;
1205 
1214  virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
1215 
1231  virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
1232 
1236  QgsLayoutSize applyDataDefinedSize( const QgsLayoutSize &size );
1237 
1238  private:
1239 
1240  // true if layout manages the z value for this item
1241  bool mLayoutManagesZValue = false;
1242 
1244  QString mId;
1245 
1247  QString mUuid;
1248 
1250  QString mTemplateUuid;
1251 
1253  QString mParentGroupUuid;
1254 
1255  ReferencePoint mReferencePoint = UpperLeft;
1256  QgsLayoutSize mFixedSize;
1257  QgsLayoutSize mMinimumSize;
1258 
1259  QgsLayoutSize mItemSize;
1260  QgsLayoutPoint mItemPosition;
1261  double mItemRotation = 0.0;
1262 
1264  bool mExcludeFromExports = false;
1265 
1270  bool mEvaluatedExcludeFromExports = false;
1271 
1273  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1274  std::unique_ptr< QgsLayoutEffect > mEffect;
1275 
1277  double mOpacity = 1.0;
1278  double mEvaluatedOpacity = 1.0;
1279 
1280  QImage mItemCachedImage;
1281  double mItemCacheDpi = -1;
1282 
1283  bool mIsLocked = false;
1284 
1286  bool mFrame = false;
1288  QColor mFrameColor = QColor( 0, 0, 0 );
1292  Qt::PenJoinStyle mFrameJoinStyle = Qt::MiterJoin;
1293 
1295  bool mBackground = true;
1297  QColor mBackgroundColor = QColor( 255, 255, 255 );
1298 
1299  bool mBlockUndoCommands = false;
1300 
1301  void initConnectionsToLayout();
1302 
1304  void preparePainter( QPainter *painter );
1305  bool shouldDrawAntialiased() const;
1306  bool shouldDrawDebugRect() const;
1307  QSizeF applyMinimumSize( QSizeF targetSize );
1308  QSizeF applyFixedSize( QSizeF targetSize );
1309  QgsLayoutPoint applyDataDefinedPosition( const QgsLayoutPoint &position );
1310 
1311  double applyDataDefinedRotation( double rotation );
1312  void updateStoredItemPosition();
1313  QPointF itemPositionAtReferencePoint( ReferencePoint reference, QSizeF size ) const;
1314  void setScenePos( QPointF destinationPos );
1315  bool shouldBlockUndoCommands() const;
1316 
1317  void applyDataDefinedOrientation( double &width, double &height, const QgsExpressionContext &context );
1318 
1319  friend class TestQgsLayoutItem;
1320  friend class TestQgsLayoutView;
1321  friend class QgsLayout;
1322  friend class QgsLayoutItemGroup;
1324 };
1325 
1326 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayoutItem::Flags )
1327 
1328 #endif //QGSLAYOUTITEM_H
1329 
1330 
1331 
Base class for commands to undo/redo layout and layout object changes.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
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:125
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 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.
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:45
double viewScaleFactor() const
Returns the current view zoom (scale factor).
Definition: qgslayoutitem.h:94
QgsLayoutItemRenderContext & operator=(const QgsLayoutItemRenderContext &other)=delete
QgsLayoutItemRenderContext cannot be copied.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Definition: qgslayoutitem.h:72
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:82
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.
@ UndoLegendTitleFont
Legend title font.
@ UndoBackgroundColor
Background color adjustment.
@ UndoLegendFontColor
Legend font color.
@ UndoScaleBarBoxContentSpace
Scalebar box context space.
@ UndoOverviewStyle
Map overview style.
@ UndoGridFramePenColor
Map grid frame pen color.
@ UndoMapRotation
Map rotation changed.
@ UndoOpacity
Opacity adjustment.
@ UndoIncrementalResize
Incremental resize.
@ UndoArrowHeadWidth
Arrow head width.
@ UndoScaleBarSegmentSize
Scalebar segment size.
@ 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.
@ UndoMapGridLineSymbol
Grid line symbol.
@ UndoZoomContent
Item content zoomed.
@ UndoScaleBarFontColor
Scalebar font color.
@ UndoMapGridMarkerSymbol
Grid marker symbol.
@ UndoAtlasMargin
Map atlas margin changed.
@ UndoPictureFillColor
Picture fill color.
@ UndoLegendSymbolSpace
Legend symbol spacing.
@ UndoMapGridFrameFill1Color
Map grid frame fill color 1.
@ UndoLegendSymbolWidth
Legend symbol width.
@ UndoLegendColumnCount
Legend column count.
@ UndoScaleBarSegments
Scalebar number of segments.
@ UndoLegendSymbolHeight
Legend symbol height.
@ UndoLegendGroupSpace
Legend group spacing.
@ UndoScaleBarSubdivisions
Scalebar number of subdivisions.
@ UndoSetId
Change item ID.
@ UndoLegendSubgroupIndent
Legend subgroup indent.
@ UndoScaleBarLineWidth
Scalebar line width.
@ UndoLegendRasterStrokeWidth
Legend raster stroke width.
@ UndoLegendGroupIndent
Legend group indent.
@ UndoMapGridAnnotationFontColor
Map frame annotation color.
@ UndoPictureNorthOffset
Picture north offset.
@ UndoCustomCommand
Base id for plugin based item undo commands.
@ UndoLabelFont
Label font.
@ UndoPictureStrokeColor
Picture stroke color.
@ UndoMapAnnotationDistance
Map frame annotation distance.
@ UndoScaleBarStrokeColor
Scalebar stroke color.
@ UndoShapeStyle
Shape symbol style.
@ UndoStrokeColor
Stroke color adjustment.
@ UndoScaleBarSegmentsLeft
Scalebar segments left.
@ 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.
@ 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.
virtual QIcon icon() const
Returns the item's icon.
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:51
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.
@ LayoutMillimeters
Millimeters.
Definition: qgsunittypes.h:183
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:177
#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:194
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...