QgsColorSchemeModel class

A model for colors in a color scheme.

Constructors, destructors, conversion operators

QgsColorSchemeModel(QgsColorScheme* scheme, const QString& context = QString(), const QColor& baseColor = QColor(), QObject* parent = nullptr) explicit
Constructor.

Public functions

void addColor(const QColor& color, const QString& label = QString(), bool allowDuplicate = false)
Add a color to the list.
auto baseColor() const -> QColor
Gets the base color for the color scheme used by the model.
auto colors() const -> QgsNamedColorList
Returns a list of colors shown in the widget.
auto context() const -> QString
Gets the current color scheme context for the model.
auto isDirty() const -> bool
Returns whether the color scheme model has been modified.
void setScheme(QgsColorScheme* scheme, const QString& context = QString(), const QColor& baseColor = QColor())
Sets the color scheme to show in the widget.

Function documentation

QgsColorSchemeModel::QgsColorSchemeModel(QgsColorScheme* scheme, const QString& context = QString(), const QColor& baseColor = QColor(), QObject* parent = nullptr) explicit

Constructor.

Parameters
scheme color scheme for list
context context string for color scheme
baseColor base color for color scheme
parent parent object

void QgsColorSchemeModel::addColor(const QColor& color, const QString& label = QString(), bool allowDuplicate = false)

Add a color to the list.

Parameters
color color to add
label label for color
allowDuplicate set to true to allow duplicate colors to be added (colors which are already present in the list)

QColor QgsColorSchemeModel::baseColor() const

Gets the base color for the color scheme used by the model.

Returns base color which is passed to scheme for color generation

QgsNamedColorList QgsColorSchemeModel::colors() const

Returns a list of colors shown in the widget.

Returns colors shown in the widget

QString QgsColorSchemeModel::context() const

Gets the current color scheme context for the model.

Returns context string which is passed to scheme for color generation

bool QgsColorSchemeModel::isDirty() const

Returns whether the color scheme model has been modified.

Returns true if colors have been modified

void QgsColorSchemeModel::setScheme(QgsColorScheme* scheme, const QString& context = QString(), const QColor& baseColor = QColor())

Sets the color scheme to show in the widget.

Parameters
scheme color scheme
context context for color scheme
baseColor base color for color scheme