Class: QgsLayoutItemMapGridStack¶
-
class
qgis.core.
QgsLayoutItemMapGridStack
(map: QgsLayoutItemMap)¶ Bases:
qgis._core.QgsLayoutItemMapItemStack
Constructor for QgsLayoutItemMapGridStack, attached to the specified
map
.QgsLayoutItemMapGridStack(QgsLayoutItemMapGridStack)
A collection of grids which is drawn above the map content in a QgsLayoutItemMap. The grid stack controls which grids are drawn and the order they are drawn in.
See also
New in version 3.0: Enums
Methods
Adds a new map
grid
to the stack and takes ownership of the grid.Returns a list of QgsLayoutItemMapGrids contained by the stack.
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap’s item rect.
Returns a reference to a grid with matching
gridId
within the stack.Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap’s item rect.
Moves a grid with matching
gridId
down the stack, causing it to be rendered below other grids.Moves a grid with matching
gridId
up the stack, causing it to be rendered above other grids.Removes a grid with matching
gridId
from the stack and deletes the correspondingQgsLayoutItemMapGrid
.Signals
Attributes
-
addGrid
(self, grid: QgsLayoutItemMapGrid)¶ Adds a new map
grid
to the stack and takes ownership of the grid. The grid will be added to the end of the stack, and rendered above any existing map grids already present in the stack.Note
After adding a grid to the stack, updateBoundingRect() and update() should be called for the QgsLayoutItemMap to prevent rendering artifacts.
See also
-
addItem
()¶
-
asList
(self) → List[QgsLayoutItemMapGrid]¶ Returns a list of QgsLayoutItemMapGrids contained by the stack.
-
calculateMaxGridExtension
(self) → Tuple[float, float, float, float]¶ Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap’s item rect. This method calculates the distance for each side of the map item separately.
See also
-
grid
(self, gridId: str) → QgsLayoutItemMapGrid¶ Returns a reference to a grid with matching
gridId
within the stack.grid(self, index: int) -> QgsLayoutItemMapGrid Returns a reference to a grid at the specified
index
within the stack.
-
item
()¶
-
maxGridExtension
(self) → float¶ Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap’s item rect.
See also
-
moveGridDown
(self, gridId: str)¶ Moves a grid with matching
gridId
down the stack, causing it to be rendered below other grids.Note
After moving a grid within the stack, update() should be called for the QgsLayoutItemMap to redraw the map with the new grid stack order.
See also
-
moveGridUp
(self, gridId: str)¶ Moves a grid with matching
gridId
up the stack, causing it to be rendered above other grids.Note
After moving a grid within the stack, update() should be called for the QgsLayoutItemMap to redraw the map with the new grid stack order.
See also
-
moveItemDown
()¶
-
moveItemUp
()¶
-
readXml
(self, elem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
removeGrid
(self, gridId: str)¶ Removes a grid with matching
gridId
from the stack and deletes the correspondingQgsLayoutItemMapGrid
.Note
After removing a grid from the stack, updateBoundingRect() and update() should be called for the QgsLayoutItemMap to prevent rendering artifacts.
See also
-
removeItem
()¶
-
removeItems
()¶
-