Class: QgsLayoutItemRenderContext¶
- class qgis.core.QgsLayoutItemRenderContext¶
Bases:
sip.wrapper
Contains settings and helpers relating to a render of a
QgsLayoutItem
.New in version 3.0.
QgsLayoutItemRenderContext(context:
QgsRenderContext
, viewScaleFactor: float = 1) Constructor for QgsLayoutItemRenderContext.The
renderContext
parameter specifies aQgsRenderContext
for use within the QgsLayoutItemRenderContext.The
viewScaleFactor
gives the current view zoom (scale factor). It can be used to scale render graphics so that they always appear a constant size, regardless of the current view zoom.Methods
Returns a reference to the context's render context.
Returns the current view zoom (scale factor).
- renderContext(self) QgsRenderContext ¶
Returns a reference to the context’s 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.- Return type
- viewScaleFactor(self) float ¶
Returns the current view zoom (scale factor). It can be used to scale render graphics so that they always appear a constant size, regardless of the current view zoom.
E.g. a value of 0.5 indicates that the view is zoomed out to 50% size, so rendered items must be scaled by 200% in order to have a constant visible size. A value of 2.0 indicates that the view is zoomed in 200%, so rendered items must be scaled by 50% in order to have a constant visible size.
- Return type
float