Class: QgsMapCanvasItem¶
- class qgis.gui.QgsMapCanvasItem¶
Bases:
PyQt5.QtWidgets.QGraphicsItem
An abstract class for items that can be placed on the map canvas.
QgsMapCanvasItem(mapCanvas:
QgsMapCanvas
) protected constructor: cannot be constructed directlyMethods
- rtype
QRectF
function to be implemented by derived classes
returns canvas item rectangle in map units
sets canvas item rectangle in map units
Sets render context parameters
transformation from map coordinates to screen coordinates
transformation from screen coordinates to map coordinates
schedules map canvas for repaint
called on changed extent or resize event to update position of the item
- boundingRect(self) QRectF ¶
- Return type
QRectF
- contextMenuEvent(self, QGraphicsSceneContextMenuEvent)¶
- dragEnterEvent(self, QGraphicsSceneDragDropEvent)¶
- dragLeaveEvent(self, QGraphicsSceneDragDropEvent)¶
- dragMoveEvent(self, QGraphicsSceneDragDropEvent)¶
- dropEvent(self, QGraphicsSceneDragDropEvent)¶
- focusInEvent(self, QFocusEvent)¶
- focusOutEvent(self, QFocusEvent)¶
- hoverEnterEvent(self, QGraphicsSceneHoverEvent)¶
- hoverLeaveEvent(self, QGraphicsSceneHoverEvent)¶
- hoverMoveEvent(self, QGraphicsSceneHoverEvent)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- inputMethodQuery(self, Qt.InputMethodQuery) Any ¶
- itemChange(self, QGraphicsItem.GraphicsItemChange, Any) Any ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)¶
- mouseMoveEvent(self, QGraphicsSceneMouseEvent)¶
- mousePressEvent(self, QGraphicsSceneMouseEvent)¶
- mouseReleaseEvent(self, QGraphicsSceneMouseEvent)¶
- paint(self, painter: QPainter)¶
function to be implemented by derived classes
paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: QWidget = None)
- Parameters
painter (QPainter) –
- prepareGeometryChange(self)¶
- rect(self) QgsRectangle ¶
returns canvas item rectangle in map units
- Return type
- sceneEvent(self, QEvent) bool ¶
- sceneEventFilter(self, QGraphicsItem, QEvent) bool ¶
- setRect(self, r: QgsRectangle, resetRotation: bool = True)¶
sets canvas item rectangle in map units
- Parameters
r (QgsRectangle) –
resetRotation (bool = True) –
- setRenderContextVariables(self, p: QPainter, context: QgsRenderContext) bool ¶
Sets render context parameters
- Parameters
p (QPainter) – painter for rendering
context (QgsRenderContext) – out: configured context
- Return type
bool
- Returns
True
in case of success
- toCanvasCoordinates(self, point: QgsPointXY) QPointF ¶
transformation from map coordinates to screen coordinates
- Parameters
point (QgsPointXY) –
- Return type
QPointF
- toMapCoordinates(self, point: QPoint) QgsPointXY ¶
transformation from screen coordinates to map coordinates
- Parameters
point (QPoint) –
- Return type
- updateCanvas(self)¶
schedules map canvas for repaint
- updateMicroFocus(self)¶
- updatePosition(self)¶
called on changed extent or resize event to update position of the item
- wheelEvent(self, QGraphicsSceneWheelEvent)¶