Class: QgsColorSwatchGrid¶
A grid of color swatches, which allows for user selection.
Colors are taken from an associated QgsColorScheme.
See also
QgsColorGridAction
Class Hierarchy¶
Base classes¶
Methods
Gets the base color for the widget |
|
Gets the list of colors shown in the grid |
|
Gets the current context for the grid |
|
Reload colors from scheme and redraws the widget |
|
Sets the base color for the widget |
|
Sets the current context for the grid |
Signals
Emitted when a color has been selected from the widget |
|
Emitted when mouse hovers over widget |
- class qgis.gui.QgsColorSwatchGrid[source]¶
Bases:
QWidget- __init__(scheme: QgsColorScheme | None, context: str | None = '', parent: QWidget | None = None)
Construct a new color swatch grid.
- Parameters:
scheme (Optional[QgsColorScheme]) –
QgsColorSchemefor colors to show in gridcontext (Optional[str] = '') – context string provided to color scheme
parent (Optional[QWidget] = None) – parent widget
- baseColor(self) QColor[source]¶
Gets the base color for the widget
- Return type:
QColor
- Returns:
base color which is passed to scheme for color generation
See also
- signal colorChanged(color: QColor)[source]¶
Emitted when a color has been selected from the widget
- Parameters:
color (QColor) – selected color
- colors(self) List[Tuple[QColor, str]] | None[source]¶
Gets the list of colors shown in the grid
- Return type:
Optional[List[Tuple[QColor, str]]]
- Returns:
list of colors currently shown in the grid
- context(self) str[source]¶
Gets the current context for the grid
- Return type:
str
- Returns:
context string which is passed to scheme for color generation
See also