QgsLayoutReportContext class

Stores information relating to the current reporting context for a layout.

Constructors, destructors, conversion operators

QgsLayoutReportContext(QgsLayout* layout)
Constructor for QgsLayoutReportContext.

Public functions

auto currentGeometry(const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) const -> QgsGeometry
Returns the current feature() geometry in the given crs.
auto feature() const -> QgsFeature
Returns the current feature for evaluating the layout.
auto layer() const -> QgsVectorLayer*
Returns the vector layer associated with the layout's context.
auto predefinedScales() const -> QVector<qreal>
Returns the current list of predefined scales for use with the layout.
void setFeature(const QgsFeature& feature)
Sets the current feature for evaluating the layout.
void setLayer(QgsVectorLayer* layer)
Sets the vector layer associated with the layout's context.
void setPredefinedScales(const QVector<qreal>& scales)
Sets the list of predefined scales to use with the layout.

Signals

void changed()
Emitted certain settings in the context is changed, e.g.
void layerChanged(QgsVectorLayer* layer)
Emitted when the context's layer is changed.

Function documentation

QgsGeometry QgsLayoutReportContext::currentGeometry(const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) const

Returns the current feature() geometry in the given crs.

If no CRS is specified, the original feature geometry is returned.

Reprojection only works if a valid layer is set for layer().

QgsFeature QgsLayoutReportContext::feature() const

Returns the current feature for evaluating the layout.

This feature may be used for altering an item's content and appearance for a report or atlas layout.

QgsVectorLayer* QgsLayoutReportContext::layer() const

Returns the vector layer associated with the layout's context.

QVector<qreal> QgsLayoutReportContext::predefinedScales() const

Returns the current list of predefined scales for use with the layout.

void QgsLayoutReportContext::setFeature(const QgsFeature& feature)

Sets the current feature for evaluating the layout.

This feature may be used for altering an item's content and appearance for a report or atlas layout.

Emits the changed() signal.

void QgsLayoutReportContext::setLayer(QgsVectorLayer* layer)

Sets the vector layer associated with the layout's context.

Emits the changed() signal.

void QgsLayoutReportContext::setPredefinedScales(const QVector<qreal>& scales)

Sets the list of predefined scales to use with the layout.

This is used for maps which are set to the predefined atlas scaling mode.

void QgsLayoutReportContext::changed() signal

Emitted certain settings in the context is changed, e.g.

by setting a new feature or vector layer for the context.