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¶
- 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[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
- signal hovered[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.