17 #ifndef QGSLAYOUTITEM_H    18 #define QGSLAYOUTITEM_H    20 #include "qgis_core.h"    28 #include <QGraphicsRectItem>   103     double mViewScaleFactor = 1.0;
   138     switch ( sipCpp->type() )
   141       case QGraphicsItem::UserType + 101:
   142         sipType = sipType_QgsLayoutItemGroup;
   145       case QGraphicsItem::UserType + 102:
   146         sipType = sipType_QgsLayoutItemPage;
   149       case QGraphicsItem::UserType + 103:
   150         sipType = sipType_QgsLayoutItemMap;
   153       case QGraphicsItem::UserType + 104:
   154         sipType = sipType_QgsLayoutItemPicture;
   157       case QGraphicsItem::UserType + 105:
   158         sipType = sipType_QgsLayoutItemLabel;
   161       case QGraphicsItem::UserType + 106:
   162         sipType = sipType_QgsLayoutItemLegend;
   165       case QGraphicsItem::UserType + 107:
   166         sipType = sipType_QgsLayoutItemShape;
   169       case QGraphicsItem::UserType + 108:
   170         sipType = sipType_QgsLayoutItemPolygon;
   173       case QGraphicsItem::UserType + 109:
   174         sipType = sipType_QgsLayoutItemPolyline;
   177       case QGraphicsItem::UserType + 110:
   178         sipType = sipType_QgsLayoutItemScaleBar;
   181       case QGraphicsItem::UserType + 111:
   182         sipType = sipType_QgsLayoutFrame;
   196     Q_PROPERTY( 
bool locked READ isLocked WRITE setLocked NOTIFY lockChanged )
   218       UndoIncrementalMove = 1, 
   299       FlagOverridesPaint = 1 << 1,  
   301     Q_DECLARE_FLAGS( Flags, 
Flag )
   317     virtual void cleanup();
   324     int type() 
const override;
   338     virtual QString 
uuid()
 const { 
return mUuid; }
   344     virtual Flags itemFlags() 
const;
   352     QString 
id()
 const { 
return mId; }
   360     virtual void setId( 
const QString &
id );
   368     virtual QString displayName() 
const;
   373     virtual void setSelected( 
bool selected );
   381     virtual void setVisibility( 
bool visible );
   388     void setLocked( 
bool locked );
   402     bool isGroupMember() 
const;
   451     Q_DECL_DEPRECATED 
virtual int numberExportLayers() const 
SIP_DEPRECATED;
   460     virtual 
void startLayeredExport();
   469     virtual 
void stopLayeredExport();
   478     virtual 
bool nextExportPart();
   511     void paint( QPainter *painter, 
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) 
override;
   559     virtual void attemptResize( 
const QgsLayoutSize &size, 
bool includesFrame = 
false );
   586     virtual void attemptMove( 
const QgsLayoutPoint &point, 
bool useReferencePoint = 
true, 
bool includesFrame = 
false, 
int page = -1 );
   603     void attemptSetSceneRect( 
const QRectF &rect, 
bool includesFrame = 
false );
   617     void attemptMoveBy( 
double deltaX, 
double deltaY );
   640     QPointF pagePos() 
const;
   666     double itemRotation() 
const;
   675     bool writeXml( QDomElement &parentElement, QDomDocument &document, 
const QgsReadWriteContext &context ) 
const;
   692     bool readXml( 
const QDomElement &itemElement, 
const QDomDocument &document, 
const QgsReadWriteContext &context );
   702     virtual void finalizeRestoreFromXml();
   722     virtual void setFrameEnabled( 
bool drawFrame );
   731     void setFrameStrokeColor( 
const QColor &color );
   776     void setFrameJoinStyle( Qt::PenJoinStyle style );
   790     void setBackgroundEnabled( 
bool drawBackground );
   805     void setBackgroundColor( 
const QColor &color );
   811     QPainter::CompositionMode 
blendMode()
 const { 
return mBlendMode; }
   817     void setBlendMode( QPainter::CompositionMode mode );
   835     void setItemOpacity( 
double opacity );
   841     bool excludeFromExports() 
const;
   847     void setExcludeFromExports( 
bool exclude );
   858     virtual bool containsAdvancedEffects() 
const;
   865     virtual bool requiresRasterization() 
const;
   877     virtual double estimatedFrameBleed() 
const;
   888     virtual QRectF rectWithFrame() 
const;
   896     virtual void moveContent( 
double dx, 
double dy );
   904     virtual void setMoveContentPreviewOffset( 
double dx, 
double dy );
   912     virtual void zoomContent( 
double factor, QPointF point );
   922     void beginCommand( 
const QString &commandText, 
UndoCommand command = UndoNone );
   936     void cancelCommand();
   941     bool shouldDrawItem() 
const;
   967     virtual void invalidateCache();
   972     virtual void redraw();
   991     virtual void setItemRotation( 
double rotation, 
bool adjustPosition = 
true );
   998     virtual void rotateItem( 
double angle, QPointF transformOrigin );
  1005     void frameChanged();
  1017     void rotationChanged( 
double newRotation );
  1022     void sizePositionChanged();
  1029     void backgroundTaskCountChanged( 
int count );
  1038     virtual void drawDebugRect( QPainter *painter );
  1082     virtual QSizeF applyItemSizeConstraint( QSizeF targetSize );
  1091     void refreshItemSize();
  1098     void refreshItemPosition();
  1110     void refreshItemRotation( QPointF *origin = 
nullptr );
  1117     void refreshOpacity( 
bool updateItem = 
true );
  1124     void refreshFrame( 
bool updateItem = 
true );
  1131     void refreshBackgroundColor( 
bool updateItem = 
true );
  1136     void refreshBlendMode();
  1142     QPointF adjustPointForReferencePosition( QPointF point, QSizeF size, 
ReferencePoint reference ) 
const;
  1147     QPointF positionAtReferencePoint( 
ReferencePoint reference ) 
const;
  1163     virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, 
const QgsReadWriteContext &context ) 
const;
  1180     virtual bool readPropertiesFromElement( 
const QDomElement &element, 
const QDomDocument &document, 
const QgsReadWriteContext &context );
  1190     bool mLayoutManagesZValue = 
false;
  1199     QString mTemplateUuid;
  1202     QString mParentGroupUuid;
  1210     double mItemRotation = 0.0;
  1213     bool mExcludeFromExports = 
false;
  1219     bool mEvaluatedExcludeFromExports = 
false;
  1222     QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
  1223     std::unique_ptr< QgsLayoutEffect > mEffect;
  1226     double mOpacity = 1.0;
  1227     double mEvaluatedOpacity = 1.0;
  1229     QImage mItemCachedImage;
  1230     double mItemCacheDpi = -1;
  1232     bool mIsLocked = 
false;
  1235     bool mFrame = 
false;
  1237     QColor mFrameColor = QColor( 0, 0, 0 );
  1241     Qt::PenJoinStyle mFrameJoinStyle = Qt::MiterJoin;
  1244     bool mBackground = 
true;
  1246     QColor mBackgroundColor = QColor( 255, 255, 255 );
  1248     bool mBlockUndoCommands = 
false;
  1250     void initConnectionsToLayout();
  1253     void preparePainter( QPainter *painter );
  1254     bool shouldDrawAntialiased() 
const;
  1255     bool shouldDrawDebugRect() 
const;
  1256     QSizeF applyMinimumSize( QSizeF targetSize );
  1257     QSizeF applyFixedSize( QSizeF targetSize );
  1260     double applyDataDefinedRotation( 
double rotation );
  1261     void updateStoredItemPosition();
  1262     QPointF itemPositionAtReferencePoint( 
ReferencePoint reference, QSizeF size ) 
const;
  1263     void setScenePos( QPointF destinationPos );
  1264     bool shouldBlockUndoCommands() 
const;
  1266     void applyDataDefinedOrientation( 
double &width, 
double &height, 
const QgsExpressionContext &context );
  1268     friend class TestQgsLayoutItem;
  1269     friend class TestQgsLayoutView;
  1275 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayoutItem::Flags )
  1277 #endif //QGSLAYOUTITEM_H 
The class is used as a container of context for various read/write operations on other objects...
 
QgsLayoutPoint positionWithUnits() const
Returns the item's current position, including units. 
 
double viewScaleFactor() const
Returns the current view zoom (scale factor). 
 
virtual QIcon icon() const
Returns the item's icon. 
 
Map grid frame pen color. 
 
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the objects' current state. 
 
Base class for graphical items within a QgsLayout. 
 
Lower left corner of item. 
 
Item must be placed in its own individual layer. 
 
Base class for commands to undo/redo layout and layout object changes. 
 
A layout item subclass for text labels. 
 
Item contains multiple sublayers which must be individually exported. 
 
UndoCommand
Layout item undo commands, used for collapsing undo commands. 
 
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units. 
 
bool frameEnabled() const
Returns true if the item includes a frame. 
 
A container for grouping several QgsLayoutItems. 
 
A layout item subclass that displays SVG files or raster format images (jpg, png, ...
 
Scalebar secondary fill color. 
 
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon. 
 
virtual QgsLayoutSize fixedSize() const
Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized...
 
Layout item for node based polygon shapes. 
 
QString mapTheme
Associated map theme, or an empty string if this export layer does not need to be associated with a m...
 
Item can only be placed on layers with other items of the same type, but multiple items of this type ...
 
Lower right corner of item. 
 
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) 
 
Margin for labels from edge of map. 
 
QgsLayoutMeasurement frameStrokeWidth() const
Returns the frame's stroke width. 
 
This class provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts. 
 
ReferencePoint
Fixed position reference point. 
 
QString name
User-friendly name for the export layer. 
 
A QGraphicsEffect subclass used for rendering layout items onto a scene with custom composition modes...
 
Layout graphical items for displaying a map. 
 
Layout item for node based polyline shapes. 
 
Map grid frame fill color 1. 
 
virtual QgsLayoutSize minimumSize() const
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely r...
 
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
 
Upper right corner of item. 
 
bool hasBackground() const
Returns true if the item has a background. 
 
Legend raster stroke color. 
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
QgsRenderContext & renderContext()
Returns a reference to the context's render context. 
 
QColor backgroundColor() const
Returns the background color for this item. 
 
Layout item for basic filled shapes (e.g. 
 
Map grid frame fill color 2. 
 
Scalebar map units per segment. 
 
double itemOpacity() const
Returns the item's opacity. 
 
QString id() const
Returns the item's ID name. 
 
Base id for plugin based item undo commands. 
 
Upper left corner of item. 
 
QPainter::CompositionMode blendMode() const
Returns the item's composition blending mode. 
 
Base class for layouts, which can contain items such as maps, labels, scalebars, etc. 
 
Flag
Flags for controlling how an item behaves. 
 
QColor frameStrokeColor() const
Returns the frame's stroke color. 
 
ReferencePoint referencePoint() const
Returns the reference point for positioning of the layout item. 
 
Map frame annotation color. 
 
Contains settings and helpers relating to a render of a QgsLayoutItem. 
 
virtual QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id=0, QUndoCommand *parent=nullptr)=0
Creates a new layout undo command with the specified text and parent. 
 
Legend raster stroke width. 
 
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout. 
 
Contains information about the context of a rendering operation. 
 
ExportLayerBehavior
Behavior of item when exporting to layered outputs. 
 
Map frame annotation distance. 
 
Qt::PenJoinStyle frameJoinStyle() const
Returns the join style used for drawing the item's frame. 
 
Scalebar box context space. 
 
const QgsRenderContext & renderContext() const
Returns a reference to the context's render context. 
 
virtual QString uuid() const
Returns the item identification string. 
 
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
 
Interface for layout objects which support undo/redo commands. 
 
Background color adjustment. 
 
Item can be placed on a layer with any other item (default behavior) 
 
A layout item subclass for scale bars. 
 
A base class for objects which belong to a layout. 
 
bool isLocked() const
Returns true if the item is locked, and cannot be interacted with using the mouse. 
 
QString mapLayerId
Associated map layer ID, or an empty string if this export layer is not associated with a map layer...
 
A layout item subclass for map legends. 
 
virtual void refresh()
Refreshes the object, causing a recalculation of any property overrides. 
 
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
 
Scalebar number of segments. 
 
Contains details of a particular export layer relating to a layout item. 
 
DataDefinedProperty
Data defined properties for different item types. 
 
Base class for frame items, which form a layout multiframe item. 
 
Legend icon symbol space. 
 
Item representing the paper in a layout. 
 
Map atlas margin changed.