Class: QgsSnapToGridCanvasItem

class qgis.gui.QgsSnapToGridCanvasItem(mapCanvas: QgsMapCanvas)

Bases: PyQt5.QtCore.QObject, QgsMapCanvasItem

Will automatically be added to the mapCanvas.

Shows a grid on the map canvas given a spatial resolution.

New in version 3.4.

Parameters

mapCanvas

childEvent()
connectNotify()
contextMenuEvent()
crs(self)QgsCoordinateReferenceSystem

The CRS in which the grid should be calculated. By default will be an invalid QgsCoordinateReferenceSystem and as such equal to the CRS of the map canvas.

Return type

QgsCoordinateReferenceSystem

customEvent()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enabled(self) → bool

Enable this item. It will be hidden if disabled.

Return type

bool

focusInEvent()
focusOutEvent()
hoverEnterEvent()
hoverLeaveEvent()
hoverMoveEvent()
inputMethodEvent()
inputMethodQuery()
isSignalConnected()
itemChange()
keyPressEvent()
keyReleaseEvent()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
paint(self, painter: QPainter)
Parameters

painter (QPainter) –

point(self)QgsPointXY

A point that will be highlighted on the map canvas. The point needs to be in map coordinates. The closest point on the grid will be highlighted.

Return type

QgsPointXY

precision(self) → float

The resolution of the grid in map units. If a crs has been specified it will be in CRS units.

Return type

float

prepareGeometryChange()
receivers()
sceneEvent()
sceneEventFilter()
sender()
senderSignalIndex()
setCrs(self, crs: QgsCoordinateReferenceSystem)

The CRS in which the grid should be calculated. By default will be an invalid QgsCoordinateReferenceSystem and as such equal to the CRS of the map canvas.

Parameters

crs (QgsCoordinateReferenceSystem) –

setEnabled(self, enabled: bool)

Enable this item. It will be hidden if disabled.

Parameters

enabled (bool) –

setPoint(self, point: QgsPointXY)

A point that will be highlighted on the map canvas. The point needs to be in map coordinates. The closest point on the grid will be highlighted.

Parameters

point (QgsPointXY) –

setPrecision(self, precision: float)

The resolution of the grid in map units. If a crs has been specified it will be in CRS units.

Parameters

precision (float) –

setRenderContextVariables()
timerEvent()
updateCanvas()
updateMicroFocus()
wheelEvent()