QgsLayoutGridSettings class
Contains settings relating to the appearance, spacing and offset for layout grids.
Contents
Base classes
- class QgsLayoutSerializableObject
- An interface for layout objects which can be stored and read from DOM elements.
Public types
- enum Style { StyleLines, StyleDots, StyleCrosses }
- Style for drawing the page/snapping grid.
Constructors, destructors, conversion operators
- QgsLayoutGridSettings(QgsLayout* layout)
- Constructor for QgsLayoutGridSettings.
Public functions
- auto layout() -> QgsLayout* override
- Returns the layout the object belongs to.
- void loadFromSettings()
- Loads grid settings from the application layout settings.
- auto offset() const -> QgsLayoutPoint
- Returns the offset of the page/snap grid.
- auto pen() const -> QPen
- Returns the pen used for drawing page/snap grids.
- auto readXml(const QDomElement& gridElement, const QDomDocument& document, const QgsReadWriteContext& context) -> bool override
- Sets the grid's state from a DOM element.
- auto resolution() const -> QgsLayoutMeasurement
- Returns the page/snap grid resolution.
- void setOffset(const QgsLayoutPoint& offset)
- Sets the offset of the page/snap grid.
- void setPen(const QPen& pen)
- Sets the pen used for drawing page/snap grids.
- void setResolution(QgsLayoutMeasurement resolution)
- Sets the page/snap grid resolution.
- void setStyle(const Style style)
- Sets the style used for drawing the page/snap grids.
- auto stringType() const -> QString override
- Returns the object type as a string.
- auto style() const -> Style
- Returns the style used for drawing the page/snap grids.
- auto writeXml(QDomElement& parentElement, QDomDocument& document, const QgsReadWriteContext& context) const -> bool override
- Stores the grid's state in a DOM element.
Enum documentation
enum QgsLayoutGridSettings:: Style
Style for drawing the page/snapping grid.
| Enumerators | |
|---|---|
| StyleLines | |
| StyleDots |
Solid lines. |
| StyleCrosses |
Dots. Crosses |
Function documentation
QgsLayoutPoint QgsLayoutGridSettings:: offset() const
Returns the offset of the page/snap grid.
QPen QgsLayoutGridSettings:: pen() const
Returns the pen used for drawing page/snap grids.
bool QgsLayoutGridSettings:: readXml(const QDomElement& gridElement,
const QDomDocument& document,
const QgsReadWriteContext& context) override
Sets the grid's state from a DOM element.
gridElement is the DOM node corresponding to the grid.
QgsLayoutMeasurement QgsLayoutGridSettings:: resolution() const
Returns the page/snap grid resolution.
void QgsLayoutGridSettings:: setOffset(const QgsLayoutPoint& offset)
Sets the offset of the page/snap grid.
void QgsLayoutGridSettings:: setPen(const QPen& pen)
Sets the pen used for drawing page/snap grids.
void QgsLayoutGridSettings:: setResolution(QgsLayoutMeasurement resolution)
Sets the page/snap grid resolution.
QString QgsLayoutGridSettings:: stringType() const override
Returns the object type as a string.
This string must be a unique, single word, character only representation of the item type, eg "LayoutScaleBar"
bool QgsLayoutGridSettings:: writeXml(QDomElement& parentElement,
QDomDocument& document,
const QgsReadWriteContext& context) const override
Stores the grid's state in a DOM element.
The parentElement should refer to the parent layout's DOM element.