Class: QgsCategorizedSymbolRendererWidget

class qgis.gui.QgsCategorizedSymbolRendererWidget(layer: QgsVectorLayer | None, style: QgsStyle | None, renderer: QgsFeatureRenderer | None)

Bases: QgsRendererWidget

Enums

CustomRole

Bases: enum.IntEnum

CustomRoles

alias of CustomRole

Methods

actionEvent

addCategories

addCategory

applyChangeToSymbol

Applies current symbol to selected categories, or to all categories if none is selected

applyColorRamp

Applies the color ramp passed on by the color ramp button

categoriesDoubleClicked

param idx:

categoryColumnChanged

param field:

changeCategorizedSymbol

changeCategorySymbol

changeEvent

changeSelectedSymbols

Changes the selected symbols alone for the change button, if there is a selection

changeSymbolAngle

Change marker angles of selected symbols

changeSymbolColor

Change color of selected symbols

changeSymbolOpacity

Change opacity of selected symbols

changeSymbolSize

Change marker sizes of selected symbols

changeSymbolUnit

Change units mm/map units of selected symbols

changeSymbolWidth

Change line widths of selected symbols

childEvent

closeEvent

connectNotify

contextMenuEvent

contextMenuViewCategories

copy

create

param layer:

createDataDefinedSizeLegendWidget

Creates widget to setup data-defined size legend.

createExpressionContext

rtype:

QgsExpressionContext

currentCategoryRow

Returns row index for the currently selected category (-1 if on no selection)

customEvent

deleteAllCategories

deleteCategories

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

param event:

keyReleaseEvent

leaveEvent

matchToSymbols

Replaces category symbols with the symbols from a style that have a matching name.

matchToSymbolsFromLibrary

Replaces category symbols with the symbols from the users' symbol library that have a matching name.

matchToSymbolsFromXml

Prompts for selection of an xml file, then replaces category symbols with the symbols from the XML file with a matching name.

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

paste

pasteSymbolToSelection

populateCategories

receivers

refreshSymbolView

registerDataDefinedButton

Registers a data defined override button.

renderer

rtype:

Optional[QgsFeatureRenderer]

resizeEvent

rowsMoved

selectedCategories

Returns a list of indexes for the categories under selection

selectedCategoryList

rtype:

List[QgsRendererCategory]

selectedSymbols

rtype:

List[QgsSymbol]

sender

senderSignalIndex

setContext

param context:

setSymbolLevels

param levels:

sharedPainter

showEvent

showSymbolLevels

tabletEvent

timerEvent

updateMicroFocus

updateUiFromRenderer

wheelEvent

class CustomRole(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsCategorizedSymbolRendererWidget.CustomRoles

Added in version 3.36.

  • ValueRole: Category value

baseClass

alias of QgsCategorizedSymbolRendererWidget

CustomRoles

alias of CustomRole

actionEvent(self, a0: QActionEvent | None)
addCategories(self)
addCategory(self)
applyChangeToSymbol(self)

Applies current symbol to selected categories, or to all categories if none is selected

applyColorRamp(self)

Applies the color ramp passed on by the color ramp button

categoriesDoubleClicked(self, idx: QModelIndex)
Parameters:

idx (QModelIndex)

categoryColumnChanged(self, field: str | None)
Parameters:

field (Optional[str])

changeCategorizedSymbol(self)
changeCategorySymbol(self)
changeEvent(self, a0: QEvent | None)
changeSelectedSymbols(self)

Changes the selected symbols alone for the change button, if there is a selection

changeSymbolAngle(self)

Change marker angles of selected symbols

changeSymbolColor(self)

Change color of selected symbols

changeSymbolOpacity(self)

Change opacity of selected symbols

changeSymbolSize(self)

Change marker sizes of selected symbols

changeSymbolUnit(self)

Change units mm/map units of selected symbols

changeSymbolWidth(self)

Change line widths of selected symbols

childEvent(self, a0: QChildEvent | None)
closeEvent(self, a0: QCloseEvent | None)
connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, a0: QContextMenuEvent | None)
contextMenuViewCategories(self, p: QPoint)
copy(self)
create(layer: QgsVectorLayer | None, style: QgsStyle | None, renderer: QgsFeatureRenderer | None) QgsRendererWidget | None
Parameters:
Return type:

Optional[QgsRendererWidget]

createDataDefinedSizeLegendWidget(self, symbol: QgsMarkerSymbol | None, ddsLegend: QgsDataDefinedSizeLegend | None) QgsDataDefinedSizeLegendWidget | None

Creates widget to setup data-defined size legend. Returns newly created panel - may be None if it could not be opened. Ownership is transferred to the caller.

createExpressionContext(self) QgsExpressionContext
Return type:

QgsExpressionContext

currentCategoryRow(self) int

Returns row index for the currently selected category (-1 if on no selection)

Return type:

int

customEvent(self, a0: QEvent | None)
deleteAllCategories(self)
deleteCategories(self)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, signal: QMetaMethod)
dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)
enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
focusInEvent(self, a0: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, a0: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, a0: QHideEvent | None)
initPainter(self, painter: QPainter | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
keyPressEvent(self, event: QKeyEvent | None)
Parameters:

event (Optional[QKeyEvent])

keyReleaseEvent(self, a0: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
matchToSymbols(self, style: QgsStyle | None) int

Replaces category symbols with the symbols from a style that have a matching name.

Parameters:

style (Optional[QgsStyle]) – style containing symbols to match with

Return type:

int

Returns:

number of symbols matched

matchToSymbolsFromLibrary(self)

Replaces category symbols with the symbols from the users’ symbol library that have a matching name.

See also

matchToSymbols()

matchToSymbolsFromXml(self)

Prompts for selection of an xml file, then replaces category symbols with the symbols from the XML file with a matching name.

See also

matchToSymbols()

metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
paintEvent(self, a0: QPaintEvent | None)
paste(self)
pasteSymbolToSelection(self)
populateCategories(self)
receivers(self, signal: PYQT_SIGNAL) int
refreshSymbolView(self)
registerDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsFeatureRenderer.Property)

Registers a data defined override button. Handles setting up connections for the button and initializing the button to show the correct descriptions and help text for the associated property.

renderer(self) QgsFeatureRenderer | None
Return type:

Optional[QgsFeatureRenderer]

resizeEvent(self, a0: QResizeEvent | None)
rowsMoved(self)
selectedCategories(self) List[int]

Returns a list of indexes for the categories under selection

Return type:

List[int]

selectedCategoryList(self) List[QgsRendererCategory]
Return type:

List[QgsRendererCategory]

selectedSymbols(self) List[QgsSymbol]
Return type:

List[QgsSymbol]

sender(self) QObject | None
senderSignalIndex(self) int
setContext(self, context: QgsSymbolWidgetContext)
Parameters:

context (QgsSymbolWidgetContext)

setSymbolLevels(self, levels: Iterable[QgsLegendSymbolItem], enabled: bool)
Parameters:
sharedPainter(self) QPainter | None
showEvent(self, a0: QShowEvent | None)
showSymbolLevels(self)
tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, a0: QTimerEvent | None)
updateMicroFocus(self)
updateUiFromRenderer(self)
wheelEvent(self, a0: QWheelEvent | None)