QGIS API Documentation 3.99.0-Master (a26b91b364d)
Signals | Public Member Functions | Friends | List of all members
QgsLayoutRenderContext Class Reference

Stores information relating to the current rendering settings for a layout. More...

#include <qgslayoutrendercontext.h>

Inheritance diagram for QgsLayoutRenderContext:
Inheritance graph
[legend]

Signals

void dpiChanged ()
 Emitted when the context's DPI is changed.
 
void flagsChanged (Qgis::LayoutRenderFlags flags)
 Emitted whenever the context's flags change.
 
void predefinedScalesChanged ()
 Emitted when the list of predefined scales changes.
 

Public Member Functions

 QgsLayoutRenderContext (QgsLayout *layout)
 Constructor for QgsLayoutRenderContext.
 
bool boundingBoxesVisible () const
 Returns true if the item bounding boxes should be drawn.
 
Q_DECL_DEPRECATED int currentExportLayer () const
 Returns the current item layer to draw while exporting.
 
double dpi () const
 Returns the dpi for outputting the layout.
 
QStringList exportThemes () const
 Returns a list of map themes to use during the export.
 
QgsFeatureFilterProviderfeatureFilterProvider () const
 Returns the (possibly nullptr) feature filter provider.
 
Qgis::LayoutRenderFlags flags () const
 Returns the current combination of flags used for rendering the layout.
 
bool gridVisible () const
 Returns true if the page grid should be drawn.
 
bool isPreviewRender () const
 Returns true if the render current being conducted is a preview render, i.e.
 
QgsMaskRenderSettingsmaskSettings ()
 Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders.
 
const QgsMaskRenderSettingsmaskSettings () const
 Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders.
 
QgsLayoutMeasurementConvertermeasurementConverter ()
 Returns the layout measurement converter to be used in the layout.
 
const QgsLayoutMeasurementConvertermeasurementConverter () const
 Returns the layout measurement converter to be used in the layout.
 
bool pagesVisible () const
 Returns whether the page items are be visible in the layout.
 
QVector< qreal > predefinedScales () const
 Returns the current list of predefined scales for use with the layout.
 
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy () const
 Returns the policy controlling when rasterization of content during renders is permitted.
 
Qgis::RenderContextFlags renderContextFlags () const
 Returns the combination of render context flags matched to the layout context's settings.
 
QColor selectionColor () const
 Gets color that is used for drawing of selected vector features.
 
void setBoundingBoxesVisible (bool visible)
 Sets whether the item bounding boxes should be visible.
 
Q_DECL_DEPRECATED void setCurrentExportLayer (int layer=-1)
 Sets the current item layer to draw while exporting.
 
void setDpi (double dpi)
 Sets the dpi for outputting the layout.
 
void setExportThemes (const QStringList &themes)
 Sets a list of map themes to use during the export.
 
void setFeatureFilterProvider (QgsFeatureFilterProvider *featureFilterProvider)
 Sets feature filter provider to featureFilterProvider.
 
void setFlag (Qgis::LayoutRenderFlag flag, bool on=true)
 Enables or disables a particular rendering flag for the layout.
 
void setFlags (Qgis::LayoutRenderFlags flags)
 Sets the combination of flags that will be used for rendering the layout.
 
void setGridVisible (bool visible)
 Sets whether the page grid should be visible.
 
void setMaskSettings (const QgsMaskRenderSettings &settings)
 Sets the mask render settings, which control how masks are drawn and behave during map renders.
 
void setPagesVisible (bool visible)
 Sets whether the page items should be visible in the layout.
 
void setPredefinedScales (const QVector< qreal > &scales)
 Sets the list of predefined scales to use with the layout.
 
void setRasterizedRenderingPolicy (Qgis::RasterizedRenderingPolicy policy)
 Sets the policy controlling when rasterization of content during renders is permitted.
 
void setSelectionColor (const QColor &color)
 Sets color that is used for drawing of selected vector features.
 
void setSimplifyMethod (const QgsVectorSimplifyMethod &method)
 Sets the simplification setting to use when rendering vector layers.
 
void setTextRenderFormat (Qgis::TextRenderFormat format)
 Sets the text render format, which dictates how text is rendered (e.g.
 
const QgsVectorSimplifyMethodsimplifyMethod () const
 Returns the simplification settings to use when rendering vector layers.
 
bool testFlag (Qgis::LayoutRenderFlag flag) const
 Check whether a particular rendering flag is enabled for the layout.
 
Qgis::TextRenderFormat textRenderFormat () const
 Returns the text render format, which dictates how text is rendered (e.g.
 

Friends

class LayoutContextPreviewSettingRestorer
 
class QgsLayoutExporter
 
class TestQgsLayout
 
class TestQgsLayoutLabel
 
class TestQgsLayoutMap
 

Detailed Description

Stores information relating to the current rendering settings for a layout.

Definition at line 36 of file qgslayoutrendercontext.h.

Constructor & Destructor Documentation

◆ QgsLayoutRenderContext()

QgsLayoutRenderContext::QgsLayoutRenderContext ( QgsLayout layout)

Constructor for QgsLayoutRenderContext.

Definition at line 21 of file qgslayoutrendercontext.cpp.

Member Function Documentation

◆ boundingBoxesVisible()

bool QgsLayoutRenderContext::boundingBoxesVisible ( ) const

Returns true if the item bounding boxes should be drawn.

See also
setBoundingBoxesVisible()

Definition at line 129 of file qgslayoutrendercontext.cpp.

◆ currentExportLayer()

Q_DECL_DEPRECATED int QgsLayoutRenderContext::currentExportLayer ( ) const
inline

Returns the current item layer to draw while exporting.

QgsLayoutItem subclasses which support multi-layer SVG exports must check this and customize their rendering based on the layer.

If layer is -1, all item layers should be rendered.

See also
setCurrentExportLayer()
Deprecated:
QGIS 3.40. Items should now handle this themselves, via QgsLayoutItem::exportLayerBehavior() and returning QgsLayoutItem::nextExportPart().

Definition at line 210 of file qgslayoutrendercontext.h.

◆ dpi()

double QgsLayoutRenderContext::dpi ( ) const

Returns the dpi for outputting the layout.

See also
setDpi()

Definition at line 114 of file qgslayoutrendercontext.cpp.

◆ dpiChanged

void QgsLayoutRenderContext::dpiChanged ( )
signal

Emitted when the context's DPI is changed.

◆ exportThemes()

QStringList QgsLayoutRenderContext::exportThemes ( ) const

Returns a list of map themes to use during the export.

Items which handle layered exports (e.g. maps) may utilize this list to export different representations of the item as export layers, as they iterate through these included themes.

See also
setExportThemes()
Since
QGIS 3.10

Definition at line 149 of file qgslayoutrendercontext.cpp.

◆ featureFilterProvider()

QgsFeatureFilterProvider * QgsLayoutRenderContext::featureFilterProvider ( ) const

Returns the (possibly nullptr) feature filter provider.

A feature filter provider for filtering visible features or attributes. It is currently used by QGIS Server Access Control Plugins.

Since
QGIS 3.18

Definition at line 170 of file qgslayoutrendercontext.cpp.

◆ flags()

Qgis::LayoutRenderFlags QgsLayoutRenderContext::flags ( ) const

Returns the current combination of flags used for rendering the layout.

See also
setFlags()
setFlag()
testFlag()

Definition at line 55 of file qgslayoutrendercontext.cpp.

◆ flagsChanged

void QgsLayoutRenderContext::flagsChanged ( Qgis::LayoutRenderFlags  flags)
signal

Emitted whenever the context's flags change.

See also
setFlags()

◆ gridVisible()

bool QgsLayoutRenderContext::gridVisible ( ) const

Returns true if the page grid should be drawn.

See also
setGridVisible()

Definition at line 119 of file qgslayoutrendercontext.cpp.

◆ isPreviewRender()

bool QgsLayoutRenderContext::isPreviewRender ( ) const
inline

Returns true if the render current being conducted is a preview render, i.e.

it is being rendered inside a QGraphicsView widget as opposed to a destination device (such as an image).

Definition at line 146 of file qgslayoutrendercontext.h.

◆ maskSettings() [1/2]

QgsMaskRenderSettings & QgsLayoutRenderContext::maskSettings ( )
inline

Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders.

See also
setMaskSettings()
Since
QGIS 3.38

Definition at line 283 of file qgslayoutrendercontext.h.

◆ maskSettings() [2/2]

const QgsMaskRenderSettings & QgsLayoutRenderContext::maskSettings ( ) const
inline

Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders.

See also
setMaskSettings()
Since
QGIS 3.38

Definition at line 274 of file qgslayoutrendercontext.h.

◆ measurementConverter() [1/2]

QgsLayoutMeasurementConverter & QgsLayoutRenderContext::measurementConverter ( )
inline

Returns the layout measurement converter to be used in the layout.

This converter is used for translating between other measurement units and the layout's native unit.

Definition at line 139 of file qgslayoutrendercontext.h.

◆ measurementConverter() [2/2]

const QgsLayoutMeasurementConverter & QgsLayoutRenderContext::measurementConverter ( ) const
inline

Returns the layout measurement converter to be used in the layout.

This converter is used for translating between other measurement units and the layout's native unit.

Definition at line 133 of file qgslayoutrendercontext.h.

◆ pagesVisible()

bool QgsLayoutRenderContext::pagesVisible ( ) const
inline

Returns whether the page items are be visible in the layout.

This setting effects both display of the page boundaries in layout views and whether they will be rendered in layout exports.

See also
setPagesVisible()

Definition at line 186 of file qgslayoutrendercontext.h.

◆ predefinedScales()

QVector< qreal > QgsLayoutRenderContext::predefinedScales ( ) const
inline

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

See also
setPredefinedScales()
Since
QGIS 3.10

Definition at line 329 of file qgslayoutrendercontext.h.

◆ predefinedScalesChanged

void QgsLayoutRenderContext::predefinedScalesChanged ( )
signal

Emitted when the list of predefined scales changes.

See also
predefinedScales()
Since
QGIS 3.10

◆ rasterizedRenderingPolicy()

Qgis::RasterizedRenderingPolicy QgsLayoutRenderContext::rasterizedRenderingPolicy ( ) const

Returns the policy controlling when rasterization of content during renders is permitted.

See also
setRasterizedRenderingPolicy()
Since
QGIS 3.44

Definition at line 83 of file qgslayoutrendercontext.cpp.

◆ renderContextFlags()

Qgis::RenderContextFlags QgsLayoutRenderContext::renderContextFlags ( ) const

Returns the combination of render context flags matched to the layout context's settings.

Definition at line 65 of file qgslayoutrendercontext.cpp.

◆ selectionColor()

QColor QgsLayoutRenderContext::selectionColor ( ) const
inline

Gets color that is used for drawing of selected vector features.

See also
setSelectionColor()
Since
QGIS 3.4

Definition at line 127 of file qgslayoutrendercontext.h.

◆ setBoundingBoxesVisible()

void QgsLayoutRenderContext::setBoundingBoxesVisible ( bool  visible)

Sets whether the item bounding boxes should be visible.

See also
boundingBoxesVisible()

Definition at line 134 of file qgslayoutrendercontext.cpp.

◆ setCurrentExportLayer()

Q_DECL_DEPRECATED void QgsLayoutRenderContext::setCurrentExportLayer ( int  layer = -1)
inline

Sets the current item layer to draw while exporting.

QgsLayoutItem subclasses which support multi-layer SVG exports must check the currentExportLayer() and customize their rendering based on the layer.

If layer is -1, all item layers will be rendered.

See also
currentExportLayer()
Deprecated:
QGIS 3.40. Items should now handle this themselves, via QgsLayoutItem::exportLayerBehavior() and returning QgsLayoutItem::nextExportPart().

Definition at line 198 of file qgslayoutrendercontext.h.

◆ setDpi()

void QgsLayoutRenderContext::setDpi ( double  dpi)

Sets the dpi for outputting the layout.

This also sets the corresponding DPI for the context's measurementConverter().

See also
dpi()

Definition at line 105 of file qgslayoutrendercontext.cpp.

◆ setExportThemes()

void QgsLayoutRenderContext::setExportThemes ( const QStringList &  themes)

Sets a list of map themes to use during the export.

Items which handle layered exports (e.g. maps) may utilize this list to export different representations of the item as export layers, as they iterate through these included themes.

See also
exportThemes()
Since
QGIS 3.10

Definition at line 154 of file qgslayoutrendercontext.cpp.

◆ setFeatureFilterProvider()

void QgsLayoutRenderContext::setFeatureFilterProvider ( QgsFeatureFilterProvider featureFilterProvider)

Sets feature filter provider to featureFilterProvider.

A feature filter provider for filtering visible features or attributes. It is currently used by QGIS Server Access Control Plugins.

Since
QGIS 3.18

Definition at line 175 of file qgslayoutrendercontext.cpp.

◆ setFlag()

void QgsLayoutRenderContext::setFlag ( Qgis::LayoutRenderFlag  flag,
bool  on = true 
)

Enables or disables a particular rendering flag for the layout.

Other existing flags are not affected.

See also
setFlags()
flags()
testFlag()

Definition at line 39 of file qgslayoutrendercontext.cpp.

◆ setFlags()

void QgsLayoutRenderContext::setFlags ( Qgis::LayoutRenderFlags  flags)

Sets the combination of flags that will be used for rendering the layout.

See also
setFlag()
flags()
testFlag()

Definition at line 29 of file qgslayoutrendercontext.cpp.

◆ setGridVisible()

void QgsLayoutRenderContext::setGridVisible ( bool  visible)

Sets whether the page grid should be visible.

See also
gridVisible()

Definition at line 124 of file qgslayoutrendercontext.cpp.

◆ setMaskSettings()

void QgsLayoutRenderContext::setMaskSettings ( const QgsMaskRenderSettings settings)

Sets the mask render settings, which control how masks are drawn and behave during map renders.

See also
maskSettings()
Since
QGIS 3.38

Definition at line 144 of file qgslayoutrendercontext.cpp.

◆ setPagesVisible()

void QgsLayoutRenderContext::setPagesVisible ( bool  visible)

Sets whether the page items should be visible in the layout.

Removing them will prevent both display of the page boundaries in layout views and will also prevent them from being rendered in layout exports.

See also
pagesVisible()

Definition at line 139 of file qgslayoutrendercontext.cpp.

◆ setPredefinedScales()

void QgsLayoutRenderContext::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.

See also
predefinedScales()
Since
QGIS 3.10

Definition at line 159 of file qgslayoutrendercontext.cpp.

◆ setRasterizedRenderingPolicy()

void QgsLayoutRenderContext::setRasterizedRenderingPolicy ( Qgis::RasterizedRenderingPolicy  policy)

Sets the policy controlling when rasterization of content during renders is permitted.

See also
rasterizedRenderingPolicy()
Since
QGIS 3.44

Definition at line 88 of file qgslayoutrendercontext.cpp.

◆ setSelectionColor()

void QgsLayoutRenderContext::setSelectionColor ( const QColor &  color)
inline

Sets color that is used for drawing of selected vector features.

See also
selectionColor()
Since
QGIS 3.4

Definition at line 120 of file qgslayoutrendercontext.h.

◆ setSimplifyMethod()

void QgsLayoutRenderContext::setSimplifyMethod ( const QgsVectorSimplifyMethod method)
inline

Sets the simplification setting to use when rendering vector layers.

If the simplify method is enabled, it apply to all vector layers rendered inside map items.

This can be used to specify global simplification methods to apply during map exports, e.g. to allow vector layers to be simplified to an appropriate maximum level of detail during PDF exports (avoiding excessive PDF size due to huge numbers of vertices).

The default is to use no simplification.

Note
This simplification method is only used during non-preview renders.
See also
simplifyMethod()
Since
QGIS 3.10

Definition at line 251 of file qgslayoutrendercontext.h.

◆ setTextRenderFormat()

void QgsLayoutRenderContext::setTextRenderFormat ( Qgis::TextRenderFormat  format)
inline

Sets the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

See also
textRenderFormat()
Since
QGIS 3.4.3

Definition at line 229 of file qgslayoutrendercontext.h.

◆ simplifyMethod()

const QgsVectorSimplifyMethod & QgsLayoutRenderContext::simplifyMethod ( ) const
inline

Returns the simplification settings to use when rendering vector layers.

If enabled, it will apply to all vector layers rendered for the map.

The default is to use no simplification.

Note
This simplification method is only used during non-preview renders.
See also
setSimplifyMethod()
Since
QGIS 3.10

Definition at line 265 of file qgslayoutrendercontext.h.

◆ testFlag()

bool QgsLayoutRenderContext::testFlag ( Qgis::LayoutRenderFlag  flag) const

Check whether a particular rendering flag is enabled for the layout.

See also
setFlags()
setFlag()
flags()

Definition at line 60 of file qgslayoutrendercontext.cpp.

◆ textRenderFormat()

Qgis::TextRenderFormat QgsLayoutRenderContext::textRenderFormat ( ) const
inline

Returns the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

See also
setTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 218 of file qgslayoutrendercontext.h.

Friends And Related Symbol Documentation

◆ LayoutContextPreviewSettingRestorer

friend class LayoutContextPreviewSettingRestorer
friend

Definition at line 405 of file qgslayoutrendercontext.h.

◆ QgsLayoutExporter

friend class QgsLayoutExporter
friend

Definition at line 403 of file qgslayoutrendercontext.h.

◆ TestQgsLayout

friend class TestQgsLayout
friend

Definition at line 404 of file qgslayoutrendercontext.h.

◆ TestQgsLayoutLabel

friend class TestQgsLayoutLabel
friend

Definition at line 407 of file qgslayoutrendercontext.h.

◆ TestQgsLayoutMap

friend class TestQgsLayoutMap
friend

Definition at line 406 of file qgslayoutrendercontext.h.


The documentation for this class was generated from the following files: