QgsColorPreviewWidget class

A preview box which displays one or two colors as swatches.

Base classes

class QgsColorWidget
A base class for interactive color widgets.

Constructors, destructors, conversion operators

QgsColorPreviewWidget(QWidget* parent = nullptr)
Construct a new color preview widget.

Public functions

auto color2() const -> QColor
Returns the secondary color for the widget.

Public slots

void setColor2(const QColor& color) virtual
Sets the second color for the widget.

Function documentation

QgsColorPreviewWidget::QgsColorPreviewWidget(QWidget* parent = nullptr)

Construct a new color preview widget.

Parameters
parent parent QWidget for the widget

QColor QgsColorPreviewWidget::color2() const

Returns the secondary color for the widget.

Returns secondary widget color, or an invalid color if the widget has no secondary color

void QgsColorPreviewWidget::setColor2(const QColor& color) virtual public slot

Sets the second color for the widget.

Parameters
color secondary widget color. Set to an invalid color to prevent drawing of a secondary color