Subgroup: Layout
Class: QgsLayoutItemMapGrid¶
-
class
qgis.core.
QgsLayoutItemMapGrid
¶ Bases:
qgis._core.QgsLayoutItemMapItem
An individual grid which is drawn above the map content in a
QgsLayoutItemMap
.New in version 3.0.
See also
Methods
annotationDirection
Returns the direction for drawing frame annotations, on the specified side
of the map.annotationDisplay
Returns the display mode for the grid annotations on a specified side of the map frame. annotationEnabled
Returns whether annotations are shown for the grid. annotationExpression
Returns the expression used for drawing grid annotations. annotationFont
Returns the font used for drawing grid annotations. annotationFontColor
Returns the font color used for drawing grid annotations. annotationFormat
Returns the format for drawing grid annotations. annotationFrameDistance
Returns the distance between the map frame and annotations. annotationPosition
Returns the position for the grid annotations on a specified side
of the map frame.annotationPrecision
Returns the coordinate precision for grid annotations, which is the number of decimal places shown when drawing grid annotations. blendMode
Retrieves the blending mode used for drawing the grid. blockSignals
calculateMaxExtension
Calculates the maximum distance the grid extends beyond the QgsLayoutItemMap’s item rect. childEvent
children
connectNotify
createExpressionContext
crossLength
Retrieves the length (in layout units) of the cross segments drawn for the grid. crs
Retrieves the CRS for the grid. customEvent
customProperties
Return list of keys stored in custom properties for the object. customProperty
Read a custom property from the object. dataDefinedProperties
Returns a reference to the object’s property collection, used for data defined overrides. deleteLater
disconnect
disconnectNotify
draw
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
enabled
Returns whether the item will be drawn. event
eventFilter
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] frameDivisions
Returns the type of grid divisions which are used for frames on a specified side
of the map.frameFillColor1
Retrieves the first fill color for the grid frame. frameFillColor2
Retrieves the second fill color for the grid frame. framePenColor
Retrieves the color of the stroke drawn in the grid frame. framePenSize
Retrieves the width of the stroke drawn in the grid frame. frameSideFlags
Returns the flags which control which sides of the map item the grid frame is drawn on. frameStyle
Returns the grid frame style. frameWidth
Gets the grid frame width in layout units. id
Returns the unique id for the map item. inherits
installEventFilter
intervalX
Returns the interval between grid lines in the x-direction. intervalY
Returns the interval between grid lines in the y-direction. isSignalConnected
isWidgetType
isWindowType
killTimer
layout
Returns the layout the object is attached to. lineSymbol
Returns the line symbol used for drawing grid lines. map
Returns the layout item map for the item. markerSymbol
Returns the marker symbol used for drawing grid points. maxExtension
Calculates the maximum distance the grid extends beyond the QgsLayoutItemMap’s item rect (in layout units). metaObject
moveToThread
name
Returns the friendly display name for the item. objectName
offsetX
Returns the offset for grid lines in the x-direction. offsetY
Returns the offset for grid lines in the y-direction. parent
property
propertyDefinitions
Returns the layout object property definitions. pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. readObjectPropertiesFromElement
readXml
receivers
refresh
Refreshes the object, causing a recalculation of any property overrides. removeCustomProperty
Remove a custom property from the object. removeEventFilter
sender
senderSignalIndex
setAnnotationDirection
Sets the direction
for drawing frame annotations for the specified mapside
.setAnnotationDisplay
Sets what types of grid annotations should be drawn for a specified side of the map frame, or whether grid annotations should be disabled for the side. setAnnotationEnabled
Sets whether annotations should be shown for the grid. setAnnotationExpression
Sets the expression
used for drawing grid annotations.setAnnotationFont
Sets the font
used for drawing grid annotations.setAnnotationFontColor
Sets the font color
used for drawing grid annotations.setAnnotationFormat
Sets the format
for drawing grid annotations.setAnnotationFrameDistance
Sets the distance
between the map frame and annotations.setAnnotationPosition
Sets the position
for the grid annotations on a specifiedside
of the map frame.setAnnotationPrecision
Sets the coordinate precision
for grid annotations.setBlendMode
Sets the blending mode
used for drawing the grid.setCrossLength
Sets the length
(in layout units) of the cross segments drawn for the grid.setCrs
Sets the crs
for the grid.setCustomProperty
Set a custom property for the object. setDataDefinedProperties
Sets the objects’s property collection, used for data defined overrides. setEnabled
Controls whether the item will be drawn. setFrameDivisions
Sets what type of grid divisions
should be used for frames on a specifiedside
of the map.setFrameFillColor1
Sets the first fill color
used for the grid frame.setFrameFillColor2
Sets the second fill color
used for the grid frame.setFramePenColor
Sets the color
of the stroke drawn in the grid frame.setFramePenSize
Sets the width
of the stroke drawn in the grid frame.setFrameSideFlag
Sets whether the grid frame is drawn for a certain side of the map item. setFrameSideFlags
Sets flags
for grid frame sides.setFrameStyle
Sets the grid frame style
.setFrameWidth
Sets the grid frame width
(in layout units).setGridLineColor
Sets the color
of grid lines.setGridLineWidth
Sets the width
of grid lines (in layout units).setIntervalX
Sets the interval
between grid lines in the x-direction.setIntervalY
Sets the interval
between grid lines in the y-direction.setLineSymbol
Sets the line symbol
used for drawing grid lines.setMap
Sets the corresponding layout map
for the item.setMarkerSymbol
Sets the marker symbol
used for drawing grid points.setName
Sets the friendly display name
for the item.setObjectName
setOffsetX
Sets the offset
for grid lines in the x-direction.setOffsetY
Sets the offset
for grid lines in the y-direction.setParent
setProperty
setStyle
Sets the grid style
, which controls how the grid is drawn over the map’s contents.setUnits
Sets the unit
to use for grid measurements such as the interval and offset for grid lines.signalsBlocked
startTimer
style
Returns the grid’s style, which controls how the grid is drawn over the map’s contents. testFrameSideFlag
Tests whether the grid frame should be drawn on a specified side of the map item. thread
timerEvent
tr
units
Returns the units used for grid measurements such as the interval and offset for grid lines. usesAdvancedEffects
writeObjectPropertiesToElement
writeXml
Attributes
AllProperties
BackgroundColor
BlendMode
Bottom
BoundaryDirection
CM
Cross
CustomFormat
Decimal
DecimalWithSuffix
DegreeMinute
DegreeMinuteNoSuffix
DegreeMinutePadded
DegreeMinuteSecond
DegreeMinuteSecondNoSuffix
DegreeMinuteSecondPadded
EvaluatedValue
ExcludeFromExports
ExteriorTicks
FrameAnnotationsOnly
FrameBottom
FrameColor
FrameLeft
FrameRight
FrameTop
HideAll
Horizontal
InsideMapFrame
InteriorExteriorTicks
InteriorTicks
ItemHeight
ItemRotation
ItemWidth
Latitude
LatitudeOnly
Left
LegendColumnCount
LegendTitle
LineBorder
Longitude
LongitudeOnly
MM
MapAtlasMargin
MapLayers
MapRotation
MapScale
MapStylePreset
MapUnit
MapXMax
MapXMin
MapYMax
MapYMin
Markers
NoFrame
NoProperty
NumPages
Opacity
OriginalValue
OutsideMapFrame
PageNumber
PaperHeight
PaperOrientation
PaperWidth
PictureSource
PictureSvgBackgroundColor
PictureSvgStrokeColor
PictureSvgStrokeWidth
PositionX
PositionY
PresetPaperSize
Right
ScalebarFillColor
ScalebarFillColor2
ScalebarLineColor
ScalebarLineWidth
ShowAll
Solid
SourceUrl
TestProperty
Top
Transparency
Vertical
VerticalDescending
Zebra
changed
Emitted when the object’s properties change. destroyed
destroyed(self, QObject = None) [signal] objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
class
AnnotationCoordinate
¶ Bases:
int
-
class
AnnotationDirection
¶ Bases:
int
-
class
AnnotationFormat
¶ Bases:
int
-
class
AnnotationPosition
¶ Bases:
int
-
class
BorderSide
¶ Bases:
int
-
Bottom
= 2¶
-
BoundaryDirection
= 3¶
-
CM
= 2¶
-
Cross
= 1¶
-
CustomFormat
= 8¶
-
Decimal
= 0¶
-
DecimalWithSuffix
= 3¶
-
DegreeMinute
= 1¶
-
DegreeMinuteNoSuffix
= 4¶
-
DegreeMinutePadded
= 5¶
-
DegreeMinuteSecond
= 2¶
-
DegreeMinuteSecondNoSuffix
= 6¶
-
DegreeMinuteSecondPadded
= 7¶
-
class
DisplayMode
¶ Bases:
int
-
ExteriorTicks
= 3¶
-
FrameAnnotationsOnly
= 3¶
-
FrameBottom
= 8¶
-
FrameLeft
= 1¶
-
FrameRight
= 2¶
-
class
FrameSideFlag
¶ Bases:
int
-
class
FrameSideFlags
¶ Bases:
sip.wrapper
QgsLayoutItemMapGrid.FrameSideFlags(Union[QgsLayoutItemMapGrid.FrameSideFlags, QgsLayoutItemMapGrid.FrameSideFlag]) QgsLayoutItemMapGrid.FrameSideFlags(QgsLayoutItemMapGrid.FrameSideFlags)
-
class
FrameStyle
¶ Bases:
int
-
FrameTop
= 4¶
-
class
GridStyle
¶ Bases:
int
-
class
GridUnit
¶ Bases:
int
-
HideAll
= 3¶
-
Horizontal
= 0¶
-
InsideMapFrame
= 0¶
-
InteriorExteriorTicks
= 4¶
-
InteriorTicks
= 2¶
-
Latitude
= 1¶
-
LatitudeOnly
= 1¶
-
Left
= 0¶
-
LineBorder
= 5¶
-
Longitude
= 0¶
-
LongitudeOnly
= 2¶
-
MM
= 1¶
-
MapUnit
= 0¶
-
Markers
= 2¶
-
NoFrame
= 0¶
-
OutsideMapFrame
= 1¶
-
Right
= 1¶
-
ShowAll
= 0¶
-
Solid
= 0¶
-
Top
= 3¶
-
Vertical
= 1¶
-
VerticalDescending
= 2¶
-
Zebra
= 1¶
-
annotationDirection
(self, border: QgsLayoutItemMapGrid.BorderSide) → QgsLayoutItemMapGrid.AnnotationDirection¶ Returns the direction for drawing frame annotations, on the specified
side
of the map.See also
-
annotationDisplay
(self, border: QgsLayoutItemMapGrid.BorderSide) → QgsLayoutItemMapGrid.DisplayMode¶ Returns the display mode for the grid annotations on a specified side of the map frame. This property also specifies whether annotations have been disabled from a side of the map frame.
Parameters: border – side of map for annotations Returns: display mode for grid annotations See also
-
annotationEnabled
(self) → bool¶ Returns whether annotations are shown for the grid.
See also
-
annotationExpression
(self) → str¶ Returns the expression used for drawing grid annotations. This is only used when annotationFormat() is QgsLayoutItemMapGrid.CustomFormat.
See also
-
annotationFont
(self) → QFont¶ Returns the font used for drawing grid annotations.
See also
-
annotationFontColor
(self) → QColor¶ Returns the font color used for drawing grid annotations.
See also
-
annotationFormat
(self) → QgsLayoutItemMapGrid.AnnotationFormat¶ Returns the format for drawing grid annotations.
See also
-
annotationFrameDistance
(self) → float¶ Returns the distance between the map frame and annotations. Units are in layout units.
See also
-
annotationPosition
(self, side: QgsLayoutItemMapGrid.BorderSide) → QgsLayoutItemMapGrid.AnnotationPosition¶ Returns the position for the grid annotations on a specified
side
of the map frame.See also
-
annotationPrecision
(self) → int¶ Returns the coordinate precision for grid annotations, which is the number of decimal places shown when drawing grid annotations.
See also
-
blendMode
(self) → QPainter.CompositionMode¶ Retrieves the blending mode used for drawing the grid.
See also
-
calculateMaxExtension
(self) → Tuple[float, float, float, float]¶ Calculates the maximum distance the grid extends beyond the QgsLayoutItemMap’s item rect. This method calculates the distance for each side of the map item separately.
See also
-
childEvent
()¶
-
connectNotify
()¶
-
createExpressionContext
(self) → QgsExpressionContext¶
-
crossLength
(self) → float¶ Retrieves the length (in layout units) of the cross segments drawn for the grid. This is only used for grids with QgsLayoutItemMapGrid.Cross styles.
See also
-
customEvent
()¶
-
disconnectNotify
()¶
-
draw
(self, painter: QPainter)¶
-
frameDivisions
(self, side: QgsLayoutItemMapGrid.BorderSide) → QgsLayoutItemMapGrid.DisplayMode¶ Returns the type of grid divisions which are used for frames on a specified
side
of the map.See also
-
frameFillColor1
(self) → QColor¶ Retrieves the first fill color for the grid frame.
See also
See also
See also
-
frameFillColor2
(self) → QColor¶ Retrieves the second fill color for the grid frame.
See also
See also
See also
-
framePenColor
(self) → QColor¶ Retrieves the color of the stroke drawn in the grid frame.
See also
See also
See also
See also
-
framePenSize
(self) → float¶ Retrieves the width of the stroke drawn in the grid frame.
See also
See also
-
frameSideFlags
(self) → QgsLayoutItemMapGrid.FrameSideFlags¶ Returns the flags which control which sides of the map item the grid frame is drawn on.
See also
See also
See also
-
frameStyle
(self) → QgsLayoutItemMapGrid.FrameStyle¶ Returns the grid frame style.
See also
-
frameWidth
(self) → float¶ Gets the grid frame width in layout units. This property controls how wide the grid frame is. The size of the line outlines drawn in the frame can be retrieved via the framePenSize method.
See also
-
intervalX
(self) → float¶ Returns the interval between grid lines in the x-direction. The units are retrieved through the units() method.
See also
See also
-
intervalY
(self) → float¶ Returns the interval between grid lines in the y-direction. The units are retrieved through the units() method.
See also
See also
-
isSignalConnected
()¶
-
lineSymbol
(self) → QgsLineSymbol¶ Returns the line symbol used for drawing grid lines. This is only used for grids with QgsLayoutItemMapGrid.Solid or QgsLayoutItemMapGrid.Cross styles.
See also
See also
See also
-
markerSymbol
(self) → QgsMarkerSymbol¶ Returns the marker symbol used for drawing grid points. This is only used for grids with a QgsLayoutItemMapGrid.Markers style.
See also
See also
See also
-
maxExtension
(self) → float¶ Calculates the maximum distance the grid extends beyond the QgsLayoutItemMap’s item rect (in layout units).
-
offsetX
(self) → float¶ Returns the offset for grid lines in the x-direction. The units are retrieved through the units() method.
See also
See also
-
offsetY
(self) → float¶ Returns the offset for grid lines in the y-direction. The units are retrieved through the units() method.
See also
See also
-
readObjectPropertiesFromElement
()¶
-
readXml
(self, itemElem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
receivers
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setAnnotationDirection
(self, direction: QgsLayoutItemMapGrid.AnnotationDirection, side: QgsLayoutItemMapGrid.BorderSide)¶ Sets the
direction
for drawing frame annotations for the specified mapside
.See also
setAnnotationDirection(self, direction: QgsLayoutItemMapGrid.AnnotationDirection) Sets the
direction
for drawing all frame annotations.See also
-
setAnnotationDisplay
(self, display: QgsLayoutItemMapGrid.DisplayMode, border: QgsLayoutItemMapGrid.BorderSide)¶ Sets what types of grid annotations should be drawn for a specified side of the map frame, or whether grid annotations should be disabled for the side.
Parameters: - display – display mode for annotations
- border – side of map for annotations
See also
-
setAnnotationEnabled
(self, enabled: bool)¶ Sets whether annotations should be shown for the grid.
See also
-
setAnnotationExpression
(self, expression: str)¶ Sets the
expression
used for drawing grid annotations. This is only used when annotationFormat() is QgsLayoutItemMapGrid.CustomFormat.See also
-
setAnnotationFont
(self, font: QFont)¶ Sets the
font
used for drawing grid annotations.See also
-
setAnnotationFontColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the font
color
used for drawing grid annotations.See also
-
setAnnotationFormat
(self, format: QgsLayoutItemMapGrid.AnnotationFormat)¶ Sets the
format
for drawing grid annotations.See also
-
setAnnotationFrameDistance
(self, distance: float)¶ Sets the
distance
between the map frame and annotations. Units are layout units.See also
-
setAnnotationPosition
(self, position: QgsLayoutItemMapGrid.AnnotationPosition, side: QgsLayoutItemMapGrid.BorderSide)¶ Sets the
position
for the grid annotations on a specifiedside
of the map frame.See also
-
setAnnotationPrecision
(self, precision: int)¶ Sets the coordinate
precision
for grid annotations. Theprecision
indicates the number of decimal places to show when drawing grid annotations.See also
-
setBlendMode
(self, mode: QPainter.CompositionMode)¶ Sets the blending
mode
used for drawing the grid.See also
-
setCrossLength
(self, length: float)¶ Sets the
length
(in layout units) of the cross segments drawn for the grid. This is only used for grids with QgsLayoutItemMapGrid.Cross styles.See also
-
setFrameDivisions
(self, divisions: QgsLayoutItemMapGrid.DisplayMode, side: QgsLayoutItemMapGrid.BorderSide)¶ Sets what type of grid
divisions
should be used for frames on a specifiedside
of the map.See also
-
setFrameFillColor1
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the first fill
color
used for the grid frame.See also
See also
See also
-
setFrameFillColor2
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the second fill
color
used for the grid frame.See also
See also
See also
-
setFramePenColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the
color
of the stroke drawn in the grid frame.See also
See also
See also
See also
-
setFramePenSize
(self, width: float)¶ Sets the
width
of the stroke drawn in the grid frame.See also
See also
-
setFrameSideFlag
(self, flag: QgsLayoutItemMapGrid.FrameSideFlag, on: bool = True)¶ Sets whether the grid frame is drawn for a certain side of the map item.
Parameters: - flag – flag for grid frame side
- on – set to true to draw grid frame on that side of the map
See also
See also
See also
-
setFrameSideFlags
(self, flags: Union[QgsLayoutItemMapGrid.FrameSideFlags, QgsLayoutItemMapGrid.FrameSideFlag])¶ Sets
flags
for grid frame sides. Setting these flags controls which sides of the map item the grid frame is drawn on.See also
See also
See also
-
setFrameStyle
(self, style: QgsLayoutItemMapGrid.FrameStyle)¶ Sets the grid frame
style
.See also
-
setFrameWidth
(self, width: float)¶ Sets the grid frame
width
(in layout units). This property controls how wide the grid frame is. The size of the line outlines drawn in the frame is controlled through the setFramePenSize method.See also
-
setGridLineColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the
color
of grid lines. This is only used for grids with QgsLayoutItemMapGrid.Solid or QgsLayoutItemMapGrid.Cross styles. For more control over grid line appearance, use setLineSymbol instead.See also
See also
-
setGridLineWidth
(self, width: float)¶ Sets the
width
of grid lines (in layout units). This is only used for grids with QgsLayoutItemMapGrid.Solid or QgsLayoutItemMapGrid.Cross styles. For more control over grid line appearance, use setLineSymbol instead.See also
See also
-
setIntervalX
(self, interval: float)¶ Sets the
interval
between grid lines in the x-direction. The units are controlled through the setUnits methodSee also
See also
-
setIntervalY
(self, interval: float)¶ Sets the
interval
between grid lines in the y-direction. The units are controlled through the setUnits methodSee also
See also
-
setLineSymbol
(self, symbol: QgsLineSymbol)¶ Sets the line
symbol
used for drawing grid lines. This is only used for grids with QgsLayoutItemMapGrid.Solid or QgsLayoutItemMapGrid.Cross styles. Ownership ofsymbol
is transferred to the grid.See also
See also
See also
-
setMarkerSymbol
(self, symbol: QgsMarkerSymbol)¶ Sets the marker
symbol
used for drawing grid points. This is only used for grids with a QgsLayoutItemMapGrid.Markers style. Ownership ofsymbol
is transferred to the grid.See also
See also
See also
-
setOffsetX
(self, offset: float)¶ Sets the
offset
for grid lines in the x-direction. The units are controlled through the setUnits method.See also
See also
-
setOffsetY
(self, offset: float)¶ Sets the
offset
for grid lines in the y-direction. The units are controlled through the setUnits method.See also
See also
-
setStyle
(self, style: QgsLayoutItemMapGrid.GridStyle)¶ Sets the grid
style
, which controls how the grid is drawn over the map’s contents.See also
-
setUnits
(self, unit: QgsLayoutItemMapGrid.GridUnit)¶ Sets the
unit
to use for grid measurements such as the interval and offset for grid lines.See also
-
style
(self) → QgsLayoutItemMapGrid.GridStyle¶ Returns the grid’s style, which controls how the grid is drawn over the map’s contents.
See also
-
testFrameSideFlag
(self, flag: QgsLayoutItemMapGrid.FrameSideFlag) → bool¶ Tests whether the grid frame should be drawn on a specified side of the map item.
Parameters: flag – flag for grid frame side Returns: true if grid frame should be drawn for that side of the map See also
See also
See also
-
timerEvent
()¶
-
units
(self) → QgsLayoutItemMapGrid.GridUnit¶ Returns the units used for grid measurements such as the interval and offset for grid lines.
See also
-
usesAdvancedEffects
(self) → bool¶
-
writeObjectPropertiesToElement
()¶
-
writeXml
(self, elem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
class