QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
|
Base class for graphical items within a QgsLayout. More...
#include <qgslayoutitem.h>
Classes | |
struct | ExportLayerDetail |
Contains details of a particular export layer relating to a layout item. More... | |
Public Slots | |
virtual void | invalidateCache () |
Forces a deferred update of any cached image the item uses. More... | |
virtual void | redraw () |
Triggers a redraw (update) of the item. More... | |
void | refresh () override |
Refreshes the item, causing a recalculation of any property overrides and recalculation of its position and size. More... | |
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 item with this new value. More... | |
virtual void | rotateItem (double angle, QPointF transformOrigin) |
Rotates the item by a specified angle in degrees clockwise around a specified reference point. More... | |
virtual void | setItemRotation (double rotation, bool adjustPosition=true) |
Sets the layout item's rotation, in degrees clockwise. More... | |
Public Slots inherited from QgsLayoutObject | |
virtual void | refresh () |
Refreshes the object, causing a recalculation of any property overrides. More... | |
Signals | |
void | backgroundTaskCountChanged (int count) |
Emitted whenever the number of background tasks an item is executing changes. More... | |
void | clipPathChanged () |
Emitted when the item's clipping path has changed. More... | |
void | frameChanged () |
Emitted if the item's frame style changes. More... | |
void | lockChanged () |
Emitted if the item's lock status changes. More... | |
void | rotationChanged (double newRotation) |
Emitted on item rotation change. More... | |
void | sizePositionChanged () |
Emitted when the item's size or position changes. More... | |
Signals inherited from QgsLayoutObject | |
void | changed () |
Emitted when the object's properties change. More... | |
Public Member Functions | |
QgsLayoutItem (QgsLayout *layout, bool manageZValue=true) | |
Constructor for QgsLayoutItem, with the specified parent layout. More... | |
~QgsLayoutItem () override | |
virtual bool | accept (QgsStyleEntityVisitorInterface *visitor) const |
Accepts the specified style entity visitor, causing it to visit all style entities associated with the layout item. More... | |
virtual void | attemptMove (const QgsLayoutPoint &point, bool useReferencePoint=true, bool includesFrame=false, int page=-1) |
Attempts to move the item to a specified point. More... | |
void | attemptMoveBy (double deltaX, double deltaY) |
Attempts to shift the item's position by a specified deltaX and deltaY, in layout units. More... | |
virtual void | attemptResize (const QgsLayoutSize &size, bool includesFrame=false) |
Attempts to resize the item to a specified target size. More... | |
void | attemptSetSceneRect (const QRectF &rect, bool includesFrame=false) |
Attempts to update the item's position and size to match the passed rect in layout coordinates. More... | |
QColor | backgroundColor () const |
Returns the background color for this item. More... | |
void | beginCommand (const QString &commandText, UndoCommand command=UndoNone) |
Starts new undo command for this item. More... | |
QPainter::CompositionMode | blendMode () const |
Returns the item's composition blending mode. More... | |
void | cancelCommand () |
Cancels the current item command and discards it. More... | |
virtual void | cleanup () |
Called just before a batch of items are deleted, allowing them to run cleanup tasks. More... | |
virtual QgsGeometry | clipPath () const |
Returns the clipping path generated by this item, in layout coordinates. More... | |
virtual bool | containsAdvancedEffects () const |
Returns true if the item contains contents with blend modes or transparency effects which can only be reproduced by rastering the item. More... | |
QgsAbstractLayoutUndoCommand * | createCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override |
Creates a new layout undo command with the specified text and parent. More... | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
virtual QString | displayName () const |
Gets item display name. More... | |
void | endCommand () |
Completes the current item command and push it onto the layout's undo stack. More... | |
virtual double | estimatedFrameBleed () const |
Returns the estimated amount the item's frame bleeds outside the item's actual rectangle. More... | |
bool | excludeFromExports () const |
Returns whether the item should be excluded from layout exports and prints. More... | |
virtual ExportLayerBehavior | exportLayerBehavior () const |
Returns the behavior of this item during exporting to layered exports (e.g. More... | |
virtual QgsLayoutItem::ExportLayerDetail | exportLayerDetails () const |
Returns the details for the specified current export layer. More... | |
virtual void | finalizeRestoreFromXml () |
Called after all pending items have been restored from XML. More... | |
virtual QgsLayoutSize | fixedSize () const |
Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized. More... | |
bool | frameEnabled () const |
Returns true if the item includes a frame. More... | |
Qt::PenJoinStyle | frameJoinStyle () const |
Returns the join style used for drawing the item's frame. More... | |
QColor | frameStrokeColor () const |
Returns the frame's stroke color. More... | |
QgsLayoutMeasurement | frameStrokeWidth () const |
Returns the frame's stroke width. More... | |
bool | hasBackground () const |
Returns true if the item has a background. More... | |
virtual QIcon | icon () const |
Returns the item's icon. More... | |
QString | id () const |
Returns the item's ID name. More... | |
bool | isGroupMember () const |
Returns true if the item is part of a QgsLayoutItemGroup group. More... | |
bool | isLocked () const |
Returns true if the item is locked, and cannot be interacted with using the mouse. More... | |
virtual Flags | itemFlags () const |
Returns the item's flags, which indicate how the item behaves. More... | |
double | itemOpacity () const |
Returns the item's opacity. More... | |
double | itemRotation () const |
Returns the current rotation for the item, in degrees clockwise. More... | |
virtual QgsLayoutSize | minimumSize () const |
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely resized. More... | |
virtual void | moveContent (double dx, double dy) |
Moves the content of the item, by a specified dx and dy in layout units. More... | |
virtual bool | nextExportPart () |
Moves to the next export part for a multi-layered export item, during a multi-layered export. More... | |
virtual Q_DECL_DEPRECATED int | numberExportLayers () const |
Returns the number of layers that this item requires for exporting during layered exports (e.g. More... | |
int | page () const |
Returns the page the item is currently on, with the first page returning 0. More... | |
QPointF | pagePos () const |
Returns the item's position (in layout units) relative to the top left corner of its current page. More... | |
QgsLayoutPoint | pagePositionWithUnits () const |
Returns the item's position (in item units) relative to the top left corner of its current page. More... | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override |
Handles preparing a paint surface for the layout item and painting the item's content. More... | |
QgsLayoutItemGroup * | parentGroup () const |
Returns the item's parent group, if the item is part of a QgsLayoutItemGroup group. More... | |
QgsLayoutPoint | positionWithUnits () const |
Returns the item's current position, including units. More... | |
bool | readXml (const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets the item state from a DOM element. More... | |
virtual QRectF | rectWithFrame () const |
Returns the item's rectangular bounds, including any bleed caused by the item's frame. More... | |
ReferencePoint | referencePoint () const |
Returns the reference point for positioning of the layout item. More... | |
virtual bool | requiresRasterization () const |
Returns true if the item is drawn in such a way that forces the whole layout to be rasterized when exporting to vector formats. More... | |
void | setBackgroundColor (const QColor &color) |
Sets the background color for this item. More... | |
void | setBackgroundEnabled (bool drawBackground) |
Sets whether this item has a background drawn under it or not. More... | |
void | setBlendMode (QPainter::CompositionMode mode) |
Sets the item's composition blending mode. More... | |
void | setExcludeFromExports (bool exclude) |
Sets whether the item should be excluded from layout exports and prints. More... | |
virtual void | setFrameEnabled (bool drawFrame) |
Sets whether this item has a frame drawn around it or not. More... | |
void | setFrameJoinStyle (Qt::PenJoinStyle style) |
Sets the join style used when drawing the item's frame. More... | |
void | setFrameStrokeColor (const QColor &color) |
Sets the frame stroke color. More... | |
virtual void | setFrameStrokeWidth (QgsLayoutMeasurement width) |
Sets the frame stroke width. More... | |
virtual void | setId (const QString &id) |
Set the item's id name. More... | |
void | setItemOpacity (double opacity) |
Sets the item's opacity. More... | |
void | setLocked (bool locked) |
Sets whether the item is locked, preventing mouse interactions with the item. More... | |
virtual void | setMoveContentPreviewOffset (double dx, double dy) |
Sets temporary offset for the item, by a specified dx and dy in layout units. More... | |
void | setParentGroup (QgsLayoutItemGroup *group) |
Sets the item's parent group. More... | |
void | setReferencePoint (ReferencePoint point) |
Sets the reference point for positioning of the layout item. More... | |
virtual void | setSelected (bool selected) |
Sets whether the item should be selected. More... | |
virtual void | setVisibility (bool visible) |
Sets whether the item is visible. More... | |
bool | shouldDrawItem () const |
Returns whether the item should be drawn in the current context. More... | |
QgsLayoutSize | sizeWithUnits () const |
Returns the item's current size, including units. More... | |
virtual void | startLayeredExport () |
Starts a multi-layer export operation. More... | |
virtual void | stopLayeredExport () |
Stops a multi-layer export operation. More... | |
int | type () const override |
Returns a unique graphics item type identifier. More... | |
virtual QString | uuid () const |
Returns the item identification string. More... | |
bool | writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores the item state in a DOM element. More... | |
virtual void | zoomContent (double factor, QPointF point) |
Zooms content of item. More... | |
Public Member Functions inherited from QgsLayoutObject | |
QgsLayoutObject (QgsLayout *layout) | |
Constructor for QgsLayoutObject, with the specified parent layout. More... | |
QgsExpressionContext | createExpressionContext () const override |
Creates an expression context relating to the objects' current state. More... | |
QStringList | customProperties () const |
Returns list of keys stored in custom properties for the object. More... | |
QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
Read a custom property from the object. More... | |
QgsPropertyCollection & | dataDefinedProperties () |
Returns a reference to the object's property collection, used for data defined overrides. More... | |
const QgsPropertyCollection & | dataDefinedProperties () const |
Returns a reference to the object's property collection, used for data defined overrides. More... | |
QgsLayout * | layout () |
Returns the layout the object is attached to. More... | |
const QgsLayout * | layout () const |
Returns the layout the object is attached to. More... | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from the object. More... | |
void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for the object. More... | |
void | setDataDefinedProperties (const QgsPropertyCollection &collection) |
Sets the objects's property collection, used for data defined overrides. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
virtual QgsExpressionContext | createExpressionContext () const =0 |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
Public Member Functions inherited from QgsLayoutUndoObjectInterface | |
virtual | ~QgsLayoutUndoObjectInterface ()=default |
Destructor for QgsLayoutUndoObjectInterface. More... | |
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. More... | |
Protected Member Functions | |
QPointF | adjustPointForReferencePosition (QPointF point, QSizeF size, ReferencePoint reference) const |
Adjusts the specified point at which a reference position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position. More... | |
QgsLayoutSize | applyDataDefinedSize (const QgsLayoutSize &size) |
Applies any present data defined size overrides to the specified layout size. More... | |
virtual QSizeF | applyItemSizeConstraint (QSizeF targetSize) |
Applies any item-specific size constraint handling to a given targetSize in layout units. More... | |
virtual void | draw (QgsLayoutItemRenderContext &context)=0 |
Draws the item's contents using the specified item render context. More... | |
virtual void | drawBackground (QgsRenderContext &context) |
Draws the background for the item. More... | |
virtual void | drawDebugRect (QPainter *painter) |
Draws a debugging rectangle of the item's current bounds within the specified painter. More... | |
virtual void | drawFrame (QgsRenderContext &context) |
Draws the frame around the item. More... | |
virtual QPainterPath | framePath () const |
Returns the path to use when drawing the item's frame or background. More... | |
QPointF | positionAtReferencePoint (ReferencePoint reference) const |
Returns the current position (in layout units) of a reference point for the item. More... | |
virtual bool | readPropertiesFromElement (const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets item state from a DOM element. More... | |
void | refreshBackgroundColor (bool updateItem=true) |
Refresh item's background color, considering data defined colors. More... | |
void | refreshBlendMode () |
Refresh item's blend mode, considering data defined blend mode. More... | |
void | refreshFrame (bool updateItem=true) |
Refresh item's frame, considering data defined colors and frame size. More... | |
void | refreshItemPosition () |
Refreshes an item's position by rechecking it against any possible overrides such as data defined positioning. More... | |
void | refreshItemRotation (QPointF *origin=nullptr) |
Refreshes an item's rotation by rechecking it against any possible overrides such as data defined rotation. More... | |
void | refreshItemSize () |
Refreshes an item's size by rechecking it against any possible item fixed or minimum sizes. More... | |
void | refreshOpacity (bool updateItem=true) |
Refresh item's opacity, considering data defined opacity. More... | |
virtual void | setFixedSize (const QgsLayoutSize &size) |
Sets a fixed size for the layout item, which prevents it from being freely resized. More... | |
virtual void | setMinimumSize (const QgsLayoutSize &size) |
Sets the minimum allowed size for the layout item. More... | |
QgsLayoutPoint | topLeftToReferencePoint (const QgsLayoutPoint &point) const |
Returns the position for the reference point of the item, if the top-left of the item was placed at the specified point. More... | |
virtual bool | writePropertiesToElement (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores item state within an XML DOM element. More... | |
Protected Member Functions inherited from QgsLayoutObject | |
bool | readObjectPropertiesFromElement (const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets object properties from a DOM element. More... | |
bool | writeObjectPropertiesToElement (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores object properties within an XML DOM element. More... | |
Properties | |
bool | locked |
Friends | |
class | QgsCompositionConverter |
class | QgsLayout |
class | QgsLayoutItemGroup |
class | TestQgsLayoutItem |
class | TestQgsLayoutView |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsLayoutObject | |
static bool | propertyAssociatesWithParentMultiframe (DataDefinedProperty property) |
Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame object instead of a child QgsLayoutFrame object. More... | |
static const QgsPropertiesDefinition & | propertyDefinitions () |
Returns the layout object property definitions. More... | |
Protected Attributes inherited from QgsLayoutObject | |
QgsObjectCustomProperties | mCustomProperties |
Custom properties for object. More... | |
QgsPropertyCollection | mDataDefinedProperties |
QPointer< QgsLayout > | mLayout |
Base class for graphical items within a QgsLayout.
Definition at line 111 of file qgslayoutitem.h.
Behavior of item when exporting to layered outputs.
Definition at line 459 of file qgslayoutitem.h.
enum QgsLayoutItem::Flag |
Flags for controlling how an item behaves.
Enumerator | |
---|---|
FlagOverridesPaint | Item overrides the default layout item painting method. |
FlagProvidesClipPath | Item can act as a clipping path provider (see clipPath()) |
Definition at line 333 of file qgslayoutitem.h.
Fixed position reference point.
Definition at line 210 of file qgslayoutitem.h.
Layout item undo commands, used for collapsing undo commands.
Definition at line 224 of file qgslayoutitem.h.
|
explicit |
Constructor for QgsLayoutItem, with the specified parent layout.
If manageZValue is true
, the z-Value of this item will be managed by the layout. Generally this is the desired behavior.
Definition at line 48 of file qgslayoutitem.cpp.
|
override |
Definition at line 95 of file qgslayoutitem.cpp.
|
virtual |
Accepts the specified style entity visitor, causing it to visit all style entities associated with the layout item.
Returns true
if the visitor should continue visiting other objects, or false
if visiting should be canceled.
Reimplemented in QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutItemPage, QgsLayoutItemPolygon, QgsLayoutItemPolyline, QgsLayoutItemScaleBar, and QgsLayoutItemShape.
Definition at line 1172 of file qgslayoutitem.cpp.
|
protected |
Adjusts the specified point at which a reference position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position.
Definition at line 1312 of file qgslayoutitem.cpp.
|
protected |
Applies any present data defined size overrides to the specified layout size.
Definition at line 1038 of file qgslayoutitem.cpp.
|
protectedvirtual |
Applies any item-specific size constraint handling to a given targetSize in layout units.
Subclasses can override this method if they need to apply advanced logic regarding item sizes, which cannot be covered by setFixedSize() or setMinimumSize(). Item size constraints are applied after fixed, minimum and data defined size constraints.
Reimplemented in QgsLayoutItemPicture.
Definition at line 1270 of file qgslayoutitem.cpp.
|
virtual |
Attempts to move the item to a specified point.
If useReferencePoint is true
, this method will respect the item's reference point, in that the item will be moved so that its current reference point is placed at the specified target point.
If useReferencePoint is false
, the item will be moved so that point falls at the top-left corner of the item.
If includesFrame is true
, then the position specified by point represents the point at which to place the outside of the item's frame.
If page is not left at the default -1 value, then the position specified by point refers to the relative position on the corresponding layout page (where a page of 0 represents the first page).
Note that the final position of the item may not match the specified target position, as data defined item position may override the specified value.
Reimplemented in QgsLayoutItemGroup.
Definition at line 473 of file qgslayoutitem.cpp.
void QgsLayoutItem::attemptMoveBy | ( | double | deltaX, |
double | deltaY | ||
) |
Attempts to shift the item's position by a specified deltaX and deltaY, in layout units.
Note that the final position of the item may not match the specified offsets, as data defined item position and size may override the specified value.
Definition at line 533 of file qgslayoutitem.cpp.
|
virtual |
Attempts to resize the item to a specified target size.
Note that the final size of the item may not match the specified target size, as items with a fixed or minimum size will place restrictions on the allowed item size. Data defined item size overrides will also override the specified target size.
If includesFrame is true
, then the size specified by size includes the item's frame.
Reimplemented in QgsLayoutItemGroup, and QgsLayoutItemPage.
Definition at line 435 of file qgslayoutitem.cpp.
void QgsLayoutItem::attemptSetSceneRect | ( | const QRectF & | rect, |
bool | includesFrame = false |
||
) |
Attempts to update the item's position and size to match the passed rect in layout coordinates.
If includesFrame is true
, then the position and size specified by rect represents the position and size at for the outside of the item's frame.
Note that the final position and size of the item may not match the specified target rect, as data defined item position and size may override the specified value.
Definition at line 517 of file qgslayoutitem.cpp.
|
inline |
Returns the background color for this item.
This is only used if hasBackground() returns true
.
Definition at line 847 of file qgslayoutitem.h.
|
signal |
Emitted whenever the number of background tasks an item is executing changes.
void QgsLayoutItem::beginCommand | ( | const QString & | commandText, |
UndoCommand | command = UndoNone |
||
) |
Starts new undo command for this item.
The commandText should be a capitalized, imperative tense description (e.g. "Add Map Item"). If specified, multiple consecutive commands for this item with the same command will be collapsed into a single undo command in the layout history.
Definition at line 974 of file qgslayoutitem.cpp.
|
inline |
Returns the item's composition blending mode.
Definition at line 860 of file qgslayoutitem.h.
void QgsLayoutItem::cancelCommand | ( | ) |
Cancels the current item command and discards it.
Definition at line 988 of file qgslayoutitem.cpp.
|
virtual |
Called just before a batch of items are deleted, allowing them to run cleanup tasks.
Reimplemented in QgsLayoutFrame, and QgsLayoutItemGroup.
Definition at line 100 of file qgslayoutitem.cpp.
|
virtual |
Returns the clipping path generated by this item, in layout coordinates.
Reimplemented in QgsLayoutItemPolygon, and QgsLayoutItemShape.
Definition at line 1178 of file qgslayoutitem.cpp.
|
signal |
|
virtual |
Returns true
if the item contains contents with blend modes or transparency effects which can only be reproduced by rastering the item.
Subclasses should ensure that implemented overrides of this method also check the base class result.
Reimplemented in QgsLayoutItemMap.
Definition at line 932 of file qgslayoutitem.cpp.
|
overridevirtual |
Creates a new layout undo command with the specified text and parent.
The id argument can be used to specify an id number for the source event - this is used to determine whether QUndoCommand command compression can apply to the command.
Implements QgsLayoutUndoObjectInterface.
Reimplemented in QgsLayoutItemPage.
Definition at line 835 of file qgslayoutitem.cpp.
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Reimplemented in QgsLayoutItemLegend, and QgsLayoutItemMap.
Definition at line 1165 of file qgslayoutitem.cpp.
|
virtual |
Gets item display name.
This is the item's id if set, and if not, a user-friendly string identifying item type.
Reimplemented in QgsLayoutItem3DMap, QgsLayoutFrame, QgsLayoutItemGroup, QgsLayoutItemLabel, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemPage, QgsLayoutItemPolygon, QgsLayoutItemPolyline, and QgsLayoutItemShape.
Definition at line 108 of file qgslayoutitem.cpp.
|
protectedpure virtual |
Draws the item's contents using the specified item render context.
Note that the context's painter has been scaled so that painter units are pixels. Use the QgsRenderContext methods to convert from millimeters or other units to the painter's units.
Implemented in QgsLayoutItem3DMap, QgsLayoutFrame, QgsLayoutItemElevationProfile, QgsLayoutItemGroup, QgsLayoutItemLabel, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutNodesItem, QgsLayoutItemPage, QgsLayoutItemPicture, QgsLayoutItemScaleBar, and QgsLayoutItemShape.
|
protectedvirtual |
Draws the background for the item.
Reimplemented in QgsLayoutFrame, and QgsLayoutItemPage.
Definition at line 1243 of file qgslayoutitem.cpp.
|
protectedvirtual |
Draws a debugging rectangle of the item's current bounds within the specified painter.
painter | destination QPainter |
Definition at line 1206 of file qgslayoutitem.cpp.
|
protectedvirtual |
Draws the frame around the item.
Reimplemented in QgsLayoutFrame, and QgsLayoutItemPage.
Definition at line 1227 of file qgslayoutitem.cpp.
void QgsLayoutItem::endCommand | ( | ) |
Completes the current item command and push it onto the layout's undo stack.
Definition at line 982 of file qgslayoutitem.cpp.
|
virtual |
Returns the estimated amount the item's frame bleeds outside the item's actual rectangle.
For instance, if the item has a 2mm frame stroke, then 1mm of this frame is drawn outside the item's rect. In this case the return value will be 1.0.
Returned values are in layout units.
Reimplemented in QgsLayoutNodesItem, and QgsLayoutItemShape.
Definition at line 943 of file qgslayoutitem.cpp.
bool QgsLayoutItem::excludeFromExports | ( | ) | const |
Returns whether the item should be excluded from layout exports and prints.
Definition at line 921 of file qgslayoutitem.cpp.
|
virtual |
Returns the behavior of this item during exporting to layered exports (e.g.
SVG).
Reimplemented in QgsLayoutFrame, QgsLayoutItemGroup, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemPage, and QgsLayoutItemScaleBar.
Definition at line 253 of file qgslayoutitem.cpp.
|
virtual |
Returns the details for the specified current export layer.
Only valid between calls to startLayeredExport() and stopLayeredExport()
Reimplemented in QgsLayoutItemMap.
Definition at line 286 of file qgslayoutitem.cpp.
|
virtual |
Called after all pending items have been restored from XML.
Items can use this method to run steps which must take place after all items have been restored to the layout, such as connecting to signals emitted by other items, which may not have existed in the layout at the time readXml() was called. E.g. a scalebar can use this to connect to its linked map item after restoration from XML.
Reimplemented in QgsLayoutItem3DMap, QgsLayoutItemGroup, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutItemPicture, and QgsLayoutItemScaleBar.
Definition at line 831 of file qgslayoutitem.cpp.
|
inlinevirtual |
Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized.
Reimplemented in QgsLayoutFrame, and QgsLayoutItemMarker.
Definition at line 584 of file qgslayoutitem.h.
|
signal |
Emitted if the item's frame style changes.
|
inline |
Returns true
if the item includes a frame.
Definition at line 762 of file qgslayoutitem.h.
|
inline |
Returns the join style used for drawing the item's frame.
Definition at line 816 of file qgslayoutitem.h.
|
protectedvirtual |
Returns the path to use when drawing the item's frame or background.
Reimplemented in QgsLayoutItemMap.
Definition at line 1220 of file qgslayoutitem.cpp.
|
inline |
Returns the frame's stroke color.
This is only used if frameEnabled() returns true
.
Definition at line 789 of file qgslayoutitem.h.
|
inline |
Returns the frame's stroke width.
This is only used if frameEnabled() returns true
.
Definition at line 807 of file qgslayoutitem.h.
|
inline |
Returns true
if the item has a background.
Definition at line 832 of file qgslayoutitem.h.
|
virtual |
Returns the item's icon.
Reimplemented in QgsLayoutItem3DMap, QgsLayoutFrame, QgsLayoutItemElevationProfile, QgsLayoutItemLabel, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutItemPicture, QgsLayoutItemPolygon, QgsLayoutItemPolyline, QgsLayoutItemScaleBar, and QgsLayoutItemShape.
Definition at line 130 of file qgslayoutitem.cpp.
|
inline |
Returns the item's ID name.
This is not necessarily unique, and duplicate ID names may exist for a layout.
Definition at line 389 of file qgslayoutitem.h.
|
virtualslot |
Forces a deferred update of any cached image the item uses.
Definition at line 1191 of file qgslayoutitem.cpp.
bool QgsLayoutItem::isGroupMember | ( | ) | const |
Returns true
if the item is part of a QgsLayoutItemGroup group.
Definition at line 231 of file qgslayoutitem.cpp.
|
inline |
Returns true
if the item is locked, and cannot be interacted with using the mouse.
Definition at line 432 of file qgslayoutitem.h.
|
virtual |
Returns the item's flags, which indicate how the item behaves.
Reimplemented in QgsLayoutItemElevationProfile, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemPolygon, and QgsLayoutItemShape.
Definition at line 135 of file qgslayoutitem.cpp.
|
inline |
Returns the item's opacity.
This method should be used instead of QGraphicsItem::opacity() as any data defined overrides will be respected.
Definition at line 875 of file qgslayoutitem.h.
double QgsLayoutItem::itemRotation | ( | ) | const |
Returns the current rotation for the item, in degrees clockwise.
Note that this method will always return the user-set rotation for the item, which may differ from the current item rotation (if data defined rotation settings are present). Use QGraphicsItem::rotation() to obtain the current item rotation.
Definition at line 612 of file qgslayoutitem.cpp.
|
signal |
Emitted if the item's lock status changes.
|
inlinevirtual |
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely resized.
Reimplemented in QgsLayoutFrame, and QgsLayoutItemScaleBar.
Definition at line 592 of file qgslayoutitem.h.
|
virtual |
Moves the content of the item, by a specified dx and dy in layout units.
The default implementation has no effect.
Reimplemented in QgsLayoutItemMap.
Definition at line 959 of file qgslayoutitem.cpp.
|
virtual |
Moves to the next export part for a multi-layered export item, during a multi-layered export.
Reimplemented in QgsLayoutItemMap.
Definition at line 273 of file qgslayoutitem.cpp.
|
virtual |
Returns the number of layers that this item requires for exporting during layered exports (e.g.
SVG). Returns 0 if this item is to be placed on the same layer as the previous item, 1 if it should be placed on its own layer, and >1 if it requires multiple export layers.
Items which require multiply layers should check QgsLayoutContext::currentExportLayer() during their rendering to determine which layer should be drawn.
Reimplemented in QgsLayoutItemMap.
Definition at line 258 of file qgslayoutitem.cpp.
int QgsLayoutItem::page | ( | ) | const |
Returns the page the item is currently on, with the first page returning 0.
Definition at line 548 of file qgslayoutitem.cpp.
QPointF QgsLayoutItem::pagePos | ( | ) | const |
Returns the item's position (in layout units) relative to the top left corner of its current page.
Definition at line 556 of file qgslayoutitem.cpp.
QgsLayoutPoint QgsLayoutItem::pagePositionWithUnits | ( | ) | const |
Returns the item's position (in item units) relative to the top left corner of its current page.
Definition at line 572 of file qgslayoutitem.cpp.
|
override |
Handles preparing a paint surface for the layout item and painting the item's content.
Derived classes must not override this method, but instead implement the pure virtual method QgsLayoutItem::draw.
Definition at line 291 of file qgslayoutitem.cpp.
QgsLayoutItemGroup * QgsLayoutItem::parentGroup | ( | ) | const |
Returns the item's parent group, if the item is part of a QgsLayoutItemGroup group.
Definition at line 236 of file qgslayoutitem.cpp.
|
protected |
Returns the current position (in layout units) of a reference point for the item.
Definition at line 1319 of file qgslayoutitem.cpp.
|
inline |
Returns the item's current position, including units.
The position returned is the position of the item's reference point, which may not necessarily be the top left corner of the item.
Definition at line 676 of file qgslayoutitem.h.
|
protectedvirtual |
Sets item state from a DOM element.
element | is the DOM element for the item |
document | DOM document |
context | read write context |
Note that item subclasses should not rely on all other items being present in the layout at the time this method is called. Instead, any connections and links to other items must be made in the finalizeRestoreFromXml() method. E.g. when restoring a scalebar, the connection to the linked map's signals should be implemented in finalizeRestoreFromXml(), not readPropertiesFromElement().
Reimplemented in QgsLayoutItem3DMap, QgsLayoutItemElevationProfile, QgsLayoutItemLabel, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutNodesItem, QgsLayoutItemPicture, QgsLayoutItemPolyline, QgsLayoutItemScaleBar, QgsLayoutItemShape, QgsLayoutFrame, QgsLayoutItemGroup, and QgsLayoutItemPage.
Definition at line 1337 of file qgslayoutitem.cpp.
bool QgsLayoutItem::readXml | ( | const QDomElement & | itemElement, |
const QDomDocument & | document, | ||
const QgsReadWriteContext & | context | ||
) |
Sets the item state from a DOM element.
itemElement | is the DOM node corresponding to item (e.g. 'LayoutItem' element) |
document | DOM document |
context | read write context |
Note that item subclasses should not rely on all other items being present in the layout at the time this method is called. Instead, any connections and links to other items must be made in the finalizeRestoreFromXml() method. E.g. when restoring a scalebar, the connection to the linked map's signals should be implemented in finalizeRestoreFromXml(), not readXml().
Definition at line 698 of file qgslayoutitem.cpp.
|
virtual |
Returns the item's rectangular bounds, including any bleed caused by the item's frame.
The bounds are returned in the item's coordinate system (see Qt's QGraphicsItem docs for more details about QGraphicsItem coordinate systems). The results differ from Qt's rect() function, as rect() makes no allowances for the portion of outlines which are drawn outside of the item.
Definition at line 953 of file qgslayoutitem.cpp.
|
virtualslot |
Triggers a redraw (update) of the item.
Definition at line 1201 of file qgslayoutitem.cpp.
|
inline |
Returns the reference point for positioning of the layout item.
This point is also fixed during resizing of the item, and any size changes will be performed so that the position of the reference point within the layout remains unchanged.
Definition at line 576 of file qgslayoutitem.h.
|
overrideslot |
Refreshes the item, causing a recalculation of any property overrides and recalculation of its position and size.
Definition at line 1183 of file qgslayoutitem.cpp.
|
protected |
Refresh item's background color, considering data defined colors.
If updateItem is set to false
, the item will not be automatically updated after the frame color is set and a later call to update() must be made.
Definition at line 1498 of file qgslayoutitem.cpp.
|
protected |
Refresh item's blend mode, considering data defined blend mode.
Definition at line 1517 of file qgslayoutitem.cpp.
|
virtualslot |
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value.
If property is set to QgsLayoutObject::AllProperties then all data defined properties for the item will be refreshed.
Reimplemented in QgsLayoutItemElevationProfile, and QgsLayoutItemScaleBar.
Definition at line 1088 of file qgslayoutitem.cpp.
|
protected |
Refresh item's frame, considering data defined colors and frame size.
If updateItem is set to false
, the item will not be automatically updated after the frame is set and a later call to update() must be made.
Definition at line 1463 of file qgslayoutitem.cpp.
|
protected |
Refreshes an item's position by rechecking it against any possible overrides such as data defined positioning.
Definition at line 1280 of file qgslayoutitem.cpp.
|
protected |
Refreshes an item's rotation by rechecking it against any possible overrides such as data defined rotation.
The optional origin point specifies the origin (in item coordinates) around which the rotation should be applied.
Definition at line 1403 of file qgslayoutitem.cpp.
|
protected |
Refreshes an item's size by rechecking it against any possible item fixed or minimum sizes.
Definition at line 1275 of file qgslayoutitem.cpp.
|
protected |
Refresh item's opacity, considering data defined opacity.
If updateItem is set to false
the item will not be automatically updated after the opacity is set and a later call to update() must be made.
Definition at line 1442 of file qgslayoutitem.cpp.
|
virtual |
Returns true
if the item is drawn in such a way that forces the whole layout to be rasterized when exporting to vector formats.
Reimplemented in QgsLayoutItemMap.
Definition at line 937 of file qgslayoutitem.cpp.
|
virtualslot |
Rotates the item by a specified angle in degrees clockwise around a specified reference point.
Definition at line 1154 of file qgslayoutitem.cpp.
|
signal |
Emitted on item rotation change.
void QgsLayoutItem::setBackgroundColor | ( | const QColor & | color | ) |
Sets the background color for this item.
Definition at line 899 of file qgslayoutitem.cpp.
void QgsLayoutItem::setBackgroundEnabled | ( | bool | drawBackground | ) |
Sets whether this item has a background drawn under it or not.
Definition at line 893 of file qgslayoutitem.cpp.
void QgsLayoutItem::setBlendMode | ( | QPainter::CompositionMode | mode | ) |
Sets the item's composition blending mode.
Definition at line 906 of file qgslayoutitem.cpp.
void QgsLayoutItem::setExcludeFromExports | ( | bool | exclude | ) |
Sets whether the item should be excluded from layout exports and prints.
Definition at line 926 of file qgslayoutitem.cpp.
|
protectedvirtual |
Sets a fixed size for the layout item, which prevents it from being freely resized.
Set an empty size if item can be freely resized.
Definition at line 1258 of file qgslayoutitem.cpp.
|
virtual |
Sets whether this item has a frame drawn around it or not.
Reimplemented in QgsLayoutItemLabel.
Definition at line 840 of file qgslayoutitem.cpp.
void QgsLayoutItem::setFrameJoinStyle | ( | Qt::PenJoinStyle | style | ) |
Sets the join style used when drawing the item's frame.
Definition at line 878 of file qgslayoutitem.cpp.
void QgsLayoutItem::setFrameStrokeColor | ( | const QColor & | color | ) |
Sets the frame stroke color.
Definition at line 853 of file qgslayoutitem.cpp.
|
virtual |
Sets the frame stroke width.
Reimplemented in QgsLayoutItemLabel, and QgsLayoutItemMap.
Definition at line 866 of file qgslayoutitem.cpp.
|
virtual |
Set the item's id name.
This is not necessarily unique, and duplicate ID names may exist for a layout.
Definition at line 140 of file qgslayoutitem.cpp.
void QgsLayoutItem::setItemOpacity | ( | double | opacity | ) |
Sets the item's opacity.
This method should be used instead of QGraphicsItem::setOpacity() as any data defined overrides will be respected.
opacity | double between 1.0 (opaque) and 0 (transparent). |
Definition at line 913 of file qgslayoutitem.cpp.
|
virtualslot |
Sets the layout item's rotation, in degrees clockwise.
If adjustPosition is true
, then this rotation occurs around the center of the item. If adjustPosition is false
, rotation occurs around the item origin.
Definition at line 1133 of file qgslayoutitem.cpp.
void QgsLayoutItem::setLocked | ( | bool | locked | ) |
Sets whether the item is locked, preventing mouse interactions with the item.
Definition at line 206 of file qgslayoutitem.cpp.
|
protectedvirtual |
Sets the minimum allowed size for the layout item.
Set an empty size if item can be freely resized.
Definition at line 1264 of file qgslayoutitem.cpp.
|
virtual |
Sets temporary offset for the item, by a specified dx and dy in layout units.
This is useful for live updates when moving item content in a QgsLayoutView. The default implementation has no effect.
Reimplemented in QgsLayoutItemMap.
Definition at line 964 of file qgslayoutitem.cpp.
void QgsLayoutItem::setParentGroup | ( | QgsLayoutItemGroup * | group | ) |
Sets the item's parent group.
Definition at line 244 of file qgslayoutitem.cpp.
void QgsLayoutItem::setReferencePoint | ( | const QgsLayoutItem::ReferencePoint | point | ) |
Sets the reference point for positioning of the layout item.
This point is also fixed during resizing of the item, and any size changes will be performed so that the position of the reference point within the layout remains unchanged.
Definition at line 421 of file qgslayoutitem.cpp.
|
virtual |
Sets whether the item should be selected.
Definition at line 166 of file qgslayoutitem.cpp.
|
virtual |
Sets whether the item is visible.
Reimplemented in QgsLayoutItemGroup.
Definition at line 176 of file qgslayoutitem.cpp.
bool QgsLayoutItem::shouldDrawItem | ( | ) | const |
Returns whether the item should be drawn in the current context.
Definition at line 597 of file qgslayoutitem.cpp.
|
signal |
Emitted when the item's size or position changes.
|
inline |
Returns the item's current size, including units.
Definition at line 703 of file qgslayoutitem.h.
|
virtual |
Starts a multi-layer export operation.
Reimplemented in QgsLayoutItemMap.
Definition at line 263 of file qgslayoutitem.cpp.
|
virtual |
Stops a multi-layer export operation.
Reimplemented in QgsLayoutItemMap.
Definition at line 268 of file qgslayoutitem.cpp.
|
protected |
Returns the position for the reference point of the item, if the top-left of the item was placed at the specified point.
Definition at line 1325 of file qgslayoutitem.cpp.
|
override |
Returns a unique graphics item type identifier.
Plugin based subclasses should return an identifier greater than QgsLayoutItemRegistry::PluginItem.
Definition at line 125 of file qgslayoutitem.cpp.
|
inlinevirtual |
Returns the item identification string.
This is a unique random string set for the item upon creation.
Definition at line 375 of file qgslayoutitem.h.
|
protectedvirtual |
Stores item state within an XML DOM element.
element | is the DOM element to store the item's properties in |
document | DOM document |
context | read write context |
Reimplemented in QgsLayoutItem3DMap, QgsLayoutItemElevationProfile, QgsLayoutItemLabel, QgsLayoutItemLegend, QgsLayoutItemMap, QgsLayoutItemMarker, QgsLayoutNodesItem, QgsLayoutItemPicture, QgsLayoutItemPolyline, QgsLayoutItemScaleBar, QgsLayoutItemShape, QgsLayoutFrame, QgsLayoutItemGroup, and QgsLayoutItemPage.
Definition at line 1332 of file qgslayoutitem.cpp.
bool QgsLayoutItem::writeXml | ( | QDomElement & | parentElement, |
QDomDocument & | document, | ||
const QgsReadWriteContext & | context | ||
) | const |
Stores the item state in a DOM element.
parentElement | parent DOM element (e.g. 'Layout' element) |
document | DOM document |
context | read write context |
Definition at line 617 of file qgslayoutitem.cpp.
|
virtual |
Zooms content of item.
Does nothing by default.
factor | zoom factor, where > 1 results in a zoom in and < 1 results in a zoom out |
point | item point for zoom center |
Reimplemented in QgsLayoutItemMap.
Definition at line 969 of file qgslayoutitem.cpp.
|
friend |
Definition at line 1353 of file qgslayoutitem.h.
|
friend |
Definition at line 1351 of file qgslayoutitem.h.
|
friend |
Definition at line 1352 of file qgslayoutitem.h.
|
friend |
Definition at line 1349 of file qgslayoutitem.h.
|
friend |
Definition at line 1350 of file qgslayoutitem.h.
|
readwrite |
Definition at line 102 of file qgslayoutitem.h.