QgsCustomColorScheme class
A color scheme which contains custom colors set through QGIS app options dialog.
Contents
Base classes
- class QgsColorScheme
- Abstract base class for color schemes.
Constructors, destructors, conversion operators
- QgsCustomColorScheme() defaulted
- Constructor for QgsCustomColorScheme.
Public functions
- auto clone() const -> QgsCustomColorScheme* override
- Clones a color scheme.
- auto fetchColors(const QString& context = QString(), const QColor& baseColor = QColor()) -> QgsNamedColorList override
- Gets a list of colors from the scheme.
- auto flags() const -> SchemeFlags override
- Returns the current flags for the color scheme.
- auto isEditable() const -> bool override
- Returns whether the color scheme is editable.
- auto schemeName() const -> QString override
- Gets the name for the color scheme.
- auto setColors(const QgsNamedColorList& colors, const QString& context = QString(), const QColor& baseColor = QColor()) -> bool override
- Sets the colors for the scheme.
Function documentation
QgsCustomColorScheme* QgsCustomColorScheme:: clone() const override
Clones a color scheme.
| Returns | copy of color scheme |
|---|
QgsNamedColorList QgsCustomColorScheme:: fetchColors(const QString& context = QString(),
const QColor& baseColor = QColor()) override
Gets a list of colors from the scheme.
| Parameters | |
|---|---|
| context | string specifying an optional context for the returned colors. For instance, a "recent colors" scheme may filter returned colors by context so that colors used only in a "composer" context are returned. |
| baseColor | base color for the scheme's colors. Some color schemes may take advantage of this to filter or modify their returned colors to colors related to the base color. |
| Returns | a list of QPairs of color and color name |
The colors can optionally be generated using the supplied context and base color.
SchemeFlags QgsCustomColorScheme:: flags() const override
Returns the current flags for the color scheme.
| Returns | current flags |
|---|
bool QgsCustomColorScheme:: isEditable() const override
Returns whether the color scheme is editable.
| Returns | true if scheme is editable |
|---|
QString QgsCustomColorScheme:: schemeName() const override
Gets the name for the color scheme.
| Returns | color scheme name |
|---|
bool QgsCustomColorScheme:: setColors(const QgsNamedColorList& colors,
const QString& context = QString(),
const QColor& baseColor = QColor()) override
Sets the colors for the scheme.
| Parameters | |
|---|---|
| colors | list of colors for the scheme |
| context | to set colors for |
| baseColor | base color to set colors for |
| Returns | true if colors were set successfully |
This method is only valid for editable color schemes.