Class: QgsLayoutGridSettings

class qgis.core.QgsLayoutGridSettings(layout: QgsLayout)

Bases: qgis._core.QgsLayoutSerializableObject

Constructor for QgsLayoutGridSettings.

QgsLayoutGridSettings(QgsLayoutGridSettings)

Contains settings relating to the appearance, spacing and offset for layout grids.

New in version 3.0: Methods

layout
loadFromSettings Loads grid settings from the application layout settings.
offset Returns the offset of the page/snap grid.
pen Returns the pen used for drawing page/snap grids.
readXml Sets the grid’s state from a DOM element.
resolution Returns the page/snap grid resolution.
setOffset Sets the offset of the page/snap grid.
setPen Sets the pen used for drawing page/snap grids.
setResolution Sets the page/snap grid resolution.
setStyle Sets the style used for drawing the page/snap grids.
stringType
style Returns the style used for drawing the page/snap grids.
writeXml Stores the grid’s state in a DOM element.

Signals

Attributes

StyleCrosses
StyleDots
StyleLines
class Style

Bases: int

StyleCrosses = 2
StyleDots = 1
StyleLines = 0
layout(self) → QgsLayout
loadFromSettings(self)

Loads grid settings from the application layout settings.

offset(self) → QgsLayoutPoint

Returns the offset of the page/snap grid.

See also

setOffset()

See also

resolution()

pen(self) → QPen

Returns the pen used for drawing page/snap grids.

See also

setPen()

See also

style()

readXml(self, gridElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool

Sets the grid’s state from a DOM element. gridElement is the DOM node corresponding to the grid.

See also

writeXml()

resolution(self) → QgsLayoutMeasurement

Returns the page/snap grid resolution.

See also

setResolution()

See also

offset()

setOffset(self, offset: QgsLayoutPoint)

Sets the offset of the page/snap grid.

See also

offset()

See also

setResolution()

setPen(self, pen: Union[QPen, QColor, Qt.GlobalColor, QGradient])

Sets the pen used for drawing page/snap grids.

See also

pen()

See also

setStyle()

setResolution(self, resolution: QgsLayoutMeasurement)

Sets the page/snap grid resolution.

See also

resolution()

See also

setOffset()

setStyle(self, style: QgsLayoutGridSettings.Style)

Sets the style used for drawing the page/snap grids.

See also

style()

See also

setPen()

stringType(self) → str
style(self) → QgsLayoutGridSettings.Style

Returns the style used for drawing the page/snap grids.

See also

setStyle()

See also

pen()

writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool

Stores the grid’s state in a DOM element. The parentElement should refer to the parent layout’s DOM element.

See also

readXml()