Class: QgsLayoutGridSettings¶
- class qgis.core.QgsLayoutGridSettings(layout: QgsLayout)¶
Bases:
QgsLayoutSerializableObject
Constructor for QgsLayoutGridSettings.
QgsLayoutGridSettings(
QgsLayoutGridSettings
)Contains settings relating to the appearance, spacing and offset for layout grids.
Methods
- rtype
QgsLayout
Loads grid settings from the application layout settings.
Returns the offset of the page/snap grid.
Returns the pen used for drawing page/snap grids.
Sets the grid’s state from a DOM element.
Returns the page/snap grid resolution.
Sets the
offset
of the page/snap grid.Sets the
pen
used for drawing page/snap grids.Sets the page/snap grid
resolution
.Sets the
style
used for drawing the page/snap grids.- rtype
str
Returns the style used for drawing the page/snap grids.
Stores the grid’s state in a DOM element.
Attributes
- class Style¶
Bases:
int
- StyleCrosses = 2¶
- StyleDots = 1¶
- StyleLines = 0¶
- loadFromSettings(self)¶
Loads grid settings from the application layout settings.
- offset(self) → QgsLayoutPoint¶
Returns the offset of the page/snap grid.
See also
See also
- Return type
- pen(self) → QPen¶
Returns the pen used for drawing page/snap grids.
See also
See also
- Return type
QPen
- 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
- Parameters
gridElement (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool
- resolution(self) → QgsLayoutMeasurement¶
Returns the page/snap grid resolution.
See also
See also
- Return type
- setOffset(self, offset: QgsLayoutPoint)¶
Sets the
offset
of the page/snap grid.See also
See also
- Parameters
offset (QgsLayoutPoint) –
- setPen(self, pen: Union[QPen, QColor, Qt.GlobalColor, QGradient])¶
Sets the
pen
used for drawing page/snap grids.See also
See also
- Parameters
pen (Union[QPen) –
- setResolution(self, resolution: QgsLayoutMeasurement)¶
Sets the page/snap grid
resolution
.See also
See also
- Parameters
resolution (QgsLayoutMeasurement) –
- setStyle(self, style: QgsLayoutGridSettings.Style)¶
Sets the
style
used for drawing the page/snap grids.See also
See also
- Parameters
style (QgsLayoutGridSettings.Style) –
- stringType(self) → str¶
- Return type
str
- style(self) → QgsLayoutGridSettings.Style¶
Returns the style used for drawing the page/snap grids.
See also
See also
- Return type
- 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
- Parameters
parentElement (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool