Class: QgsLayoutRenderContext¶
Stores information relating to the current rendering settings for a layout.
Class Hierarchy¶
Base classes¶
Enums
alias of |
Methods
Returns |
|
Returns the current item layer to draw while exporting. |
|
Returns the dpi for outputting the layout. |
|
Returns a list of map themes to use during the export. |
|
Returns the (possibly |
|
Returns the current combination of flags used for rendering the layout. |
|
Returns |
|
Returns |
|
Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders. |
|
Returns the layout measurement converter to be used in the layout. |
|
Returns whether the page items are be visible in the layout. |
|
Returns the current list of predefined scales for use with the layout. |
|
Returns the policy controlling when rasterization of content during renders is permitted. |
|
Returns the combination of render context flags matched to the layout context's settings. |
|
Gets color that is used for drawing of selected vector features |
|
Sets whether the item bounding boxes should be visible. |
|
Sets the current item layer to draw while exporting. |
|
Sets the dpi for outputting the layout. |
|
Sets a list of map themes to use during the export. |
|
Sets feature filter provider to featureFilterProvider. |
|
Enables or disables a particular rendering flag for the layout. |
|
Sets the combination of flags that will be used for rendering the layout. |
|
Sets whether the page grid should be visible. |
|
Sets the mask render settings, which control how masks are drawn and behave during map renders. |
|
Sets whether the page items should be visible in the layout. |
|
Sets the list of predefined scales to use with the layout. |
|
Sets the policy controlling when rasterization of content during renders is permitted. |
|
Sets color that is used for drawing of selected vector features |
|
Sets the simplification setting to use when rendering vector layers. |
|
Sets the text render format, which dictates how text is rendered (e.g. as paths or real text objects). |
|
Returns the simplification settings to use when rendering vector layers. |
|
Check whether a particular rendering flag is enabled for the layout. |
|
Returns the text render format, which dictates how text is rendered (e.g. as paths or real text objects). |
Signals
Emitted when the context's DPI is changed. |
|
Emitted whenever the context's flags change. |
|
Emitted when the list of predefined scales changes. |
- class qgis.core.QgsLayoutRenderContext[source]¶
Bases:
QObject
- __init__(layout: QgsLayout | None)
Constructor for QgsLayoutRenderContext.
- Parameters:
layout (Optional[QgsLayout])
- Flag¶
alias of
LayoutRenderFlag
- Flags¶
alias of
LayoutRenderFlags
- boundingBoxesVisible(self) bool [source]¶
Returns
True
if the item bounding boxes should be drawn.See also
- Return type:
bool
- currentExportLayer(self) int [source]¶
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
Deprecated since version 3.40: Items should now handle this themselves, via
QgsLayoutItem.exportLayerBehavior()
and returningQgsLayoutItem.nextExportPart()
.- Return type:
int
- exportThemes(self) List[str] [source]¶
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
Added in version 3.10.
- Return type:
List[str]
- featureFilterProvider(self) QgsFeatureFilterProvider | None [source]¶
Returns the (possibly
None
) feature filter provider.A feature filter provider for filtering visible features or attributes. It is currently used by QGIS Server Access Control Plugins.
Added in version 3.18.
- Return type:
Optional[QgsFeatureFilterProvider]
- flags(self) Qgis.LayoutRenderFlags [source]¶
Returns the current combination of flags used for rendering the layout.
See also
See also
See also
- Return type:
- signal flagsChanged(flags: Qgis.LayoutRenderFlags)[source]¶
Emitted whenever the context’s
flags
change.See also
- Parameters:
flags (Qgis.LayoutRenderFlags)
- gridVisible(self) bool [source]¶
Returns
True
if the page grid should be drawn.See also
- Return type:
bool
- isPreviewRender(self) bool [source]¶
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).- Return type:
bool
- maskSettings(self) QgsMaskRenderSettings ¶
Returns a reference to the mask render settings, which control how masks are drawn and behave during map renders.
See also
Added in version 3.38.
- Return type:
- measurementConverter(self) QgsLayoutMeasurementConverter ¶
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.
- Return type:
- pagesVisible(self) bool [source]¶
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
- Return type:
bool
- predefinedScales(self) List[float] ¶
Returns the current list of predefined scales for use with the layout.
See also
Added in version 3.10.
- Return type:
List[float]
- signal predefinedScalesChanged[source]¶
Emitted when the list of predefined scales changes.
See also
Added in version 3.10.
- rasterizedRenderingPolicy(self) Qgis.RasterizedRenderingPolicy [source]¶
Returns the policy controlling when rasterization of content during renders is permitted.
See also
Added in version 3.44.
- Return type:
- renderContextFlags(self) Qgis.RenderContextFlags [source]¶
Returns the combination of render context flags matched to the layout context’s settings.
- Return type:
- selectionColor(self) QColor [source]¶
Gets color that is used for drawing of selected vector features
See also
Added in version 3.4.
- Return type:
QColor
- setBoundingBoxesVisible(self, visible: bool)[source]¶
Sets whether the item bounding boxes should be
visible
.See also
- Parameters:
visible (bool)
- setCurrentExportLayer(self, layer: int = -1)[source]¶
Sets the current item
layer
to draw while exporting.QgsLayoutItem
subclasses which support multi-layer SVG exports must check thecurrentExportLayer()
and customize their rendering based on the layer.If
layer
is -1, all item layers will be rendered.See also
Deprecated since version 3.40: Items should now handle this themselves, via
QgsLayoutItem.exportLayerBehavior()
and returningQgsLayoutItem.nextExportPart()
.- Parameters:
layer (int = -1)
- setDpi(self, dpi: float)[source]¶
Sets the
dpi
for outputting the layout. This also sets the corresponding DPI for the context’smeasurementConverter()
.See also
- Parameters:
dpi (float)
- setExportThemes(self, themes: Iterable[str | None])[source]¶
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
Added in version 3.10.
- Parameters:
themes (Iterable[Optional[str]])
- setFeatureFilterProvider(self, featureFilterProvider: QgsFeatureFilterProvider | None)[source]¶
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.
Added in version 3.18.
- Parameters:
featureFilterProvider (Optional[QgsFeatureFilterProvider])
- setFlag(self, flag: Qgis.LayoutRenderFlag, on: bool = True)[source]¶
Enables or disables a particular rendering
flag
for the layout. Other existing flags are not affected.See also
See also
See also
- Parameters:
flag (Qgis.LayoutRenderFlag)
on (bool = True)
- setFlags(self, flags: Qgis.LayoutRenderFlags | Qgis.LayoutRenderFlag)[source]¶
Sets the combination of
flags
that will be used for rendering the layout.See also
See also
See also
- Parameters:
flags (Union[Qgis.LayoutRenderFlags, Qgis.LayoutRenderFlag])
- setGridVisible(self, visible: bool)[source]¶
Sets whether the page grid should be
visible
.See also
- Parameters:
visible (bool)
- setMaskSettings(self, settings: QgsMaskRenderSettings)[source]¶
Sets the mask render
settings
, which control how masks are drawn and behave during map renders.See also
Added in version 3.38.
- Parameters:
settings (QgsMaskRenderSettings)
- setPagesVisible(self, visible: bool)[source]¶
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
- Parameters:
visible (bool)
- setPredefinedScales(self, scales: Iterable[float])[source]¶
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
Added in version 3.10.
- Parameters:
scales (Iterable[float])
- setRasterizedRenderingPolicy(self, policy: Qgis.RasterizedRenderingPolicy)[source]¶
Sets the
policy
controlling when rasterization of content during renders is permitted.See also
Added in version 3.44.
- Parameters:
policy (Qgis.RasterizedRenderingPolicy)
- setSelectionColor(self, color: QColor | Qt.GlobalColor)[source]¶
Sets color that is used for drawing of selected vector features
See also
Added in version 3.4.
- Parameters:
color (Union[QColor, Qt.GlobalColor])
- setSimplifyMethod(self, method: QgsVectorSimplifyMethod)[source]¶
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
Added in version 3.10.
- Parameters:
method (QgsVectorSimplifyMethod)
- setTextRenderFormat(self, format: Qgis.TextRenderFormat)[source]¶
Sets the text render
format
, which dictates how text is rendered (e.g. as paths or real text objects).See also
Added in version 3.4.3.
- Parameters:
format (Qgis.TextRenderFormat)
- simplifyMethod(self) QgsVectorSimplifyMethod ¶
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
Added in version 3.10.
- Return type:
- testFlag(self, flag: Qgis.LayoutRenderFlag) bool [source]¶
Check whether a particular rendering
flag
is enabled for the layout.See also
See also
See also
- Parameters:
flag (Qgis.LayoutRenderFlag)
- Return type:
bool
- textRenderFormat(self) Qgis.TextRenderFormat [source]¶
Returns the text render format, which dictates how text is rendered (e.g. as paths or real text objects).
See also
Added in version 3.4.3.
- Return type: