Class: QgsColorSchemeModel¶
A model for colors in a color scheme
See also
Class Hierarchy¶
Base classes¶
Methods
Add a color to the list |
|
Gets the base color for the color scheme used by the model |
|
Returns a list of colors shown in the widget |
|
Gets the current color scheme context for the model |
|
Returns whether the color scheme model has been modified |
|
Sets the color scheme to show in the widget |
- class qgis.gui.QgsColorSchemeModel[source]¶
Bases:
QAbstractItemModel
- __init__(scheme: QgsColorScheme | None, context: str | None = '', baseColor: QColor | Qt.GlobalColor = QColor(), parent: QObject | None = None)
Constructor
- Parameters:
scheme (Optional[QgsColorScheme]) – color scheme for list
context (Optional[str] = '') – context string for color scheme
baseColor (Union[QColor, Qt.GlobalColor] = QColor()) – base color for color scheme
parent (Optional[QObject] = None) – parent object
- addColor(self, color: QColor | Qt.GlobalColor, label: str | None = '', allowDuplicate: bool = False)[source]¶
Add a color to the list
- Parameters:
color (Union[QColor, Qt.GlobalColor]) – color to add
label (Optional[str] = '') – label for color
allowDuplicate (bool = False) – set to
True
to allow duplicate colors to be added (colors which are already present in the list)
- baseColor(self) QColor [source]¶
Gets the base color for the color scheme used by the model
- Return type:
QColor
- Returns:
base color which is passed to scheme for color generation
See also
- colors(self) List[Tuple[QColor, str]] [source]¶
Returns a list of colors shown in the widget
- Return type:
List[Tuple[QColor, str]]
- Returns:
colors shown in the widget
- context(self) str [source]¶
Gets the current color scheme context for the model
- Return type:
str
- Returns:
context string which is passed to scheme for color generation
See also
- isDirty(self) bool [source]¶
Returns whether the color scheme model has been modified
- Return type:
bool
- Returns:
True
if colors have been modified
- setScheme(self, scheme: QgsColorScheme | None, context: str | None = '', baseColor: QColor | Qt.GlobalColor = QColor())[source]¶
Sets the color scheme to show in the widget
- Parameters:
scheme (Optional[QgsColorScheme]) – color scheme
context (Optional[str] = '') – context for color scheme
baseColor (Union[QColor, Qt.GlobalColor] = QColor()) – base color for color scheme