QgsColorTextWidget class

A line edit widget which displays colors as text and accepts string representations of colors.

Base classes

class QgsColorWidget
A base class for interactive color widgets.

Public types

enum ColorTextFormat { HexRgb = 0, HexRgbA, Rgb, Rgba }
Specifies the display format for a color.

Constructors, destructors, conversion operators

QgsColorTextWidget(QWidget* parent = nullptr)
Construct a new color line edit widget.

Public functions

void setColor(const QColor& color, bool emitSignals = false) override
Sets the color for the widget.

Enum documentation

enum QgsColorTextWidget::ColorTextFormat

Specifies the display format for a color.

Enumerators
HexRgb

#RRGGBB in hexadecimal

HexRgbA

#RRGGBBAA in hexadecimal, with alpha

Rgb

Rgb( r, g, b ) format.

Rgba

Rgba( r, g, b, a ) format, with alpha.

Function documentation

QgsColorTextWidget::QgsColorTextWidget(QWidget* parent = nullptr)

Construct a new color line edit widget.

Parameters
parent parent QWidget for the widget

void QgsColorTextWidget::setColor(const QColor& color, bool emitSignals = false) override

Sets the color for the widget.

Parameters
color widget color
emitSignals set to true to emit the colorChanged signal after setting color