QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | 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]

Public Types

enum  Flag {
  FlagDebug = 1 << 1, FlagOutlineOnly = 1 << 2, FlagAntialiasing = 1 << 3, FlagUseAdvancedEffects = 1 << 4,
  FlagForceVectorOutput = 1 << 5, FlagHideCoverageLayer = 1 << 6, FlagDrawSelection = 1 << 7
}
 Flags for controlling how a layout is rendered. More...
 

Signals

void dpiChanged ()
 Emitted when the context's DPI is changed. More...
 
void flagsChanged (QgsLayoutRenderContext::Flags flags)
 Emitted whenever the context's flags change. More...
 

Public Member Functions

 QgsLayoutRenderContext (QgsLayout *layout)
 Constructor for QgsLayoutRenderContext. More...
 
bool boundingBoxesVisible () const
 Returns true if the item bounding boxes should be drawn. More...
 
int currentExportLayer () const
 Returns the current item layer to draw while exporting. More...
 
double dpi () const
 Returns the dpi for outputting the layout. More...
 
QgsLayoutRenderContext::Flags flags () const
 Returns the current combination of flags used for rendering the layout. More...
 
bool gridVisible () const
 Returns true if the page grid should be drawn. More...
 
bool isPreviewRender () const
 Returns true if the render current being conducted is a preview render, i.e. More...
 
const QgsLayoutMeasurementConvertermeasurementConverter () const
 Returns the layout measurement converter to be used in the layout. More...
 
QgsLayoutMeasurementConvertermeasurementConverter ()
 Returns the layout measurement converter to be used in the layout. More...
 
bool pagesVisible () const
 Returns whether the page items are be visible in the layout. More...
 
QgsRenderContext::Flags renderContextFlags () const
 Returns the combination of render context flags matched to the layout context's settings. More...
 
QColor selectionColor () const
 Gets color that is used for drawing of selected vector features. More...
 
void setBoundingBoxesVisible (bool visible)
 Sets whether the item bounding boxes should be visible. More...
 
void setCurrentExportLayer (int layer=-1)
 Sets the current item layer to draw while exporting. More...
 
void setDpi (double dpi)
 Sets the dpi for outputting the layout. More...
 
void setFlag (QgsLayoutRenderContext::Flag flag, bool on=true)
 Enables or disables a particular rendering flag for the layout. More...
 
void setFlags (QgsLayoutRenderContext::Flags flags)
 Sets the combination of flags that will be used for rendering the layout. More...
 
void setGridVisible (bool visible)
 Sets whether the page grid should be visible. More...
 
void setPagesVisible (bool visible)
 Sets whether the page items should be visible in the layout. More...
 
void setSelectionColor (const QColor &color)
 Sets color that is used for drawing of selected vector features. More...
 
void setTextRenderFormat (QgsRenderContext::TextRenderFormat format)
 Sets the text render format, which dictates how text is rendered (e.g. More...
 
bool testFlag (Flag flag) const
 Check whether a particular rendering flag is enabled for the layout. More...
 
QgsRenderContext::TextRenderFormat textRenderFormat () const
 Returns the text render format, which dictates how text is rendered (e.g. More...
 

Friends

class LayoutContextPreviewSettingRestorer
 
class QgsLayoutExporter
 
class TestQgsLayout
 
class TestQgsLayoutLabel
 

Detailed Description

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

Since
QGIS 3.0

Definition at line 32 of file qgslayoutrendercontext.h.

Member Enumeration Documentation

Flags for controlling how a layout is rendered.

Enumerator
FlagDebug 

Debug/testing mode, items are drawn as solid rectangles.

FlagOutlineOnly 

Render items as outlines only.

FlagAntialiasing 

Use antialiasing when drawing items.

FlagUseAdvancedEffects 

Enable advanced effects such as blend modes.

FlagForceVectorOutput 

Force output in vector format where possible, even if items require rasterization to keep their correct appearance.

FlagHideCoverageLayer 

Hide coverage layer in outputs.

FlagDrawSelection 

Draw selection.

Definition at line 40 of file qgslayoutrendercontext.h.

Constructor & Destructor Documentation

QgsLayoutRenderContext::QgsLayoutRenderContext ( QgsLayout layout)

Constructor for QgsLayoutRenderContext.

Definition at line 20 of file qgslayoutrendercontext.cpp.

Member Function Documentation

bool QgsLayoutRenderContext::boundingBoxesVisible ( ) const

Returns true if the item bounding boxes should be drawn.

See also
setBoundingBoxesVisible()

Definition at line 97 of file qgslayoutrendercontext.cpp.

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()

Definition at line 201 of file qgslayoutrendercontext.h.

double QgsLayoutRenderContext::dpi ( ) const

Returns the dpi for outputting the layout.

See also
setDpi()

Definition at line 82 of file qgslayoutrendercontext.cpp.

void QgsLayoutRenderContext::dpiChanged ( )
signal

Emitted when the context's DPI is changed.

QgsLayoutRenderContext::Flags QgsLayoutRenderContext::flags ( ) const

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

See also
setFlags()
setFlag()
testFlag()

Definition at line 50 of file qgslayoutrendercontext.cpp.

void QgsLayoutRenderContext::flagsChanged ( QgsLayoutRenderContext::Flags  flags)
signal

Emitted whenever the context's flags change.

See also
setFlags()
bool QgsLayoutRenderContext::gridVisible ( ) const

Returns true if the page grid should be drawn.

See also
setGridVisible()

Definition at line 87 of file qgslayoutrendercontext.cpp.

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 139 of file qgslayoutrendercontext.h.

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 126 of file qgslayoutrendercontext.h.

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 132 of file qgslayoutrendercontext.h.

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 179 of file qgslayoutrendercontext.h.

QgsRenderContext::Flags QgsLayoutRenderContext::renderContextFlags ( ) const

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

Definition at line 60 of file qgslayoutrendercontext.cpp.

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 120 of file qgslayoutrendercontext.h.

void QgsLayoutRenderContext::setBoundingBoxesVisible ( bool  visible)

Sets whether the item bounding boxes should be visible.

See also
boundingBoxesVisible()

Definition at line 102 of file qgslayoutrendercontext.cpp.

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()

Definition at line 190 of file qgslayoutrendercontext.h.

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 73 of file qgslayoutrendercontext.cpp.

void QgsLayoutRenderContext::setFlag ( QgsLayoutRenderContext::Flag  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 35 of file qgslayoutrendercontext.cpp.

void QgsLayoutRenderContext::setFlags ( QgsLayoutRenderContext::Flags  flags)

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

See also
setFlag()
flags()
testFlag()

Definition at line 26 of file qgslayoutrendercontext.cpp.

void QgsLayoutRenderContext::setGridVisible ( bool  visible)

Sets whether the page grid should be visible.

See also
gridVisible()

Definition at line 92 of file qgslayoutrendercontext.cpp.

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 107 of file qgslayoutrendercontext.cpp.

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 113 of file qgslayoutrendercontext.h.

void QgsLayoutRenderContext::setTextRenderFormat ( QgsRenderContext::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 220 of file qgslayoutrendercontext.h.

bool QgsLayoutRenderContext::testFlag ( const QgsLayoutRenderContext::Flag  flag) const

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

See also
setFlags()
setFlag()
flags()

Definition at line 55 of file qgslayoutrendercontext.cpp.

QgsRenderContext::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 209 of file qgslayoutrendercontext.h.

Friends And Related Function Documentation

friend class LayoutContextPreviewSettingRestorer
friend

Definition at line 259 of file qgslayoutrendercontext.h.

friend class QgsLayoutExporter
friend

Definition at line 257 of file qgslayoutrendercontext.h.

friend class TestQgsLayout
friend

Definition at line 258 of file qgslayoutrendercontext.h.

friend class TestQgsLayoutLabel
friend

Definition at line 260 of file qgslayoutrendercontext.h.


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