Subgroup: other

Class: QgsHighlight

class qgis.gui.QgsHighlight(mapCanvas: QgsMapCanvas, geom: QgsGeometry, layer: QgsMapLayer)

Bases: PyQt5.QtCore.QObject, qgis._gui.QgsMapCanvasItem

Constructor for QgsHighlight

Parameters:
  • mapCanvas – associated map canvas
  • geom – initial geometry of highlight
  • layer – associated map layer

QgsHighlight(mapCanvas: QgsMapCanvas, feature: QgsFeature, layer: QgsVectorLayer) Constructor for highlighting true feature shape using feature attributes and renderer.

Parameters:
  • mapCanvas – map canvas
  • feature
  • layer – vector layer

A class for highlight features on the map.

The QgsHighlight class provides a transparent overlay canvas item for highlighting features or geometries on a map canvas.

      color = QColor(Qt.red)
      highlight = QgsHighlight(mapCanvas, feature, layer)
      highlight.setColor(color)
      color.setAlpha(50)
      highlight.setFillColor(color)
      highlight.show()

.. rubric:: Methods

.. autoautosummary:: qgis.gui.QgsHighlight
    :methods:
    :nosignatures:

.. rubric:: Signals

.. autoautosummary:: qgis.gui.QgsHighlight
    :signals:
    :nosignatures:

.. rubric:: Attributes

.. autoautosummary:: qgis.gui.QgsHighlight
    :attributes:
buffer(self) → float

Returns the buffer

New in version 3.4.

childEvent()
color(self) → QColor

Returns the line/stroke color

New in version 3.4.

connectNotify()
contextMenuEvent()
customEvent()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
fillColor(self) → QColor

Returns the fill color

New in version 3.4.

focusInEvent()
focusOutEvent()
hoverEnterEvent()
hoverLeaveEvent()
hoverMoveEvent()
inputMethodEvent()
inputMethodQuery()
isSignalConnected()
itemChange()
keyPressEvent()
keyReleaseEvent()
layer(self) → QgsMapLayer

Returns the layer for which this highlight has been created.

mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
paint(self, p: QPainter)
prepareGeometryChange()
receivers()
sceneEvent()
sceneEventFilter()
sender()
senderSignalIndex()
setBuffer(self, buffer: float)

Set line / stroke buffer in millimeters.

New in version 2.4.

setColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Set line/stroke to color, polygon fill to color with alpha = 63. This is legacy function, use setFillColor() after setColor() if different fill color is required. *

setFillColor(self, fillColor: Union[QColor, Qt.GlobalColor, QGradient])

Fill color for the highlight. Will be used for polygons and points.

New in version 2.4.

setMinWidth(self, width: float)

Set minimum line / stroke width in millimeters.

New in version 2.4.

setRenderContextVariables()
setWidth(self, width: int)

Set stroke width.

Note

Ignored in feature mode.

timerEvent()
updateCanvas()
updateMicroFocus()
updatePosition(self)
updateRect(self)

recalculates needed rectangle

wheelEvent()
width(self) → int

Returns the stroke width

New in version 3.4.