ColorBox Class Reference

A modified QComboBox used for color selection. More...

`#include <ColorBox.h>`

Inheritance diagram for ColorBox:

## Public Member Functions

QColor | color () const
| Return the current color. More...
| ColorBox (QWidget *parent=0)
| Constructor. More...
void | setColor (const QColor &c)
| Set the current color. More...

## Static Public Member Functions

static QColor | color (int colorIndex)
| Return the color at index 'colorIndex'. More...
static int | colorIndex (const QColor &c)
| Return the index for a given color. More...
static QList< QColor > | colorList ()
| Return the list of colors. More...
static QStringList | colorNames ()
| Returns the color names. More...
static QColor | defaultColor (int colorIndex)
| Return the default color at index 'colorIndex'. More...
static QStringList | defaultColorNames ()
| Returns the color name for the predefined colors. More...
static QList< QColor > | defaultColors ()
| Returns the list of predefined colors. More...
static bool | isValidColor (const QColor &color)
| Returns TRUE if the color is included in the color box, otherwise returns FALSE. More...
static int | numPredefinedColors ()
| Returns the number of predefined colors. More...

## Protected Member Functions

void | init ()
| Internal initialization function. More...

## Static Protected Attributes

static const QColor | colors []
| Array containing the 24 predefined colors. More...
static const int | colors_count = 24
| The number of predefined colors. More...

## Detailed Description

A modified QComboBox used for color selection.

It contains a list of 24 predefined colors.

## Constructor & Destructor Documentation

ColorBox::ColorBox | ( | QWidget * | parent = `0` | ) |

Constructor.

Parameters

  parent | parent widget

References init().

## Member Function Documentation

QColor ColorBox::color | ( |  | ) | const

Return the current color.

Referenced by PieCurve::color(), Fit::showConfidenceLimits(), Fit::showPredictionLimits(), and Fit::showResiduals().

QColor ColorBox::color | ( | int | colorIndex | ) |

static

Return the color at index 'colorIndex'.

References colorList().

int ColorBox::colorIndex | ( | const QColor & | c | ) |

static

Return the index for a given color.

References colorList(), and isValidColor().

Referenced by defaultColor(), setColor(), Fit::showConfidenceLimits(), Fit::showPredictionLimits(), and Fit::showResiduals().

QList< QColor > ColorBox::colorList | ( |  | ) |

static

Return the list of colors.

References colors, and colors_count.

Referenced by color(), ColorButton::ColorButton(), colorIndex(), init(), and isValidColor().

QStringList ColorBox::colorNames | ( |  | ) |

static

Returns the color names.

References defaultColorNames().

Referenced by ColorButton::ColorButton(), and init().

QColor ColorBox::defaultColor | ( | int | colorIndex | ) |

static

Return the default color at index 'colorIndex'.

References colorIndex(), and colors.

Referenced by Graph::addFunction(), Grid::load(), ApplicationWindow::openGraph(), ApplicationWindow::readColorFromProject(), Filter::setColor(), Graph::setCurveLineColor(), and MultiPeakFit::setPeakCurvesColor().

QStringList ColorBox::defaultColorNames | ( |  | ) |

static

Returns the color name for the predefined colors.

Referenced by ColorButton::ColorButton(), colorNames(), ConfigDialog::loadDefaultColors(), and ApplicationWindow::setDefaultOptions().

QList< QColor > ColorBox::defaultColors | ( |  | ) |

static

Returns the list of predefined colors.

References colors, and colors_count.

Referenced by ColorButton::ColorButton(), Graph::guessUniqueCurveLayout(), Graph::initCurveLayout(), ConfigDialog::loadDefaultColors(), Graph::plotBox(), ApplicationWindow::setDefaultOptions(), and Graph::setIndexedColors().

void ColorBox::init | ( |  | ) |

protected

Internal initialization function.

References colorList(), and colorNames().

Referenced by ColorBox().

bool ColorBox::isValidColor | ( | const QColor & | color | ) |

static

Returns TRUE if the color is included in the color box, otherwise returns FALSE.

References colorList().

Referenced by colorIndex(), and Filter::setColor().

int ColorBox::numPredefinedColors | ( |  | ) |

static

Returns the number of predefined colors.

References colors_count.

Referenced by PieCurve::color(), and ColorButton::ColorButton().

void ColorBox::setColor | ( | const QColor & | c | ) |

Set the current color.

References colorIndex().

## Member Data Documentation

const QColor ColorBox::colors

static protected

Initial value:
= {
QColor(Qt::black),
QColor(Qt::red),
QColor(Qt::green),
QColor(Qt::blue),
QColor(Qt::cyan),
QColor(Qt::magenta),
QColor(Qt::yellow),
QColor(Qt::darkYellow),
QColor(Qt::darkBlue),
QColor(Qt::darkMagenta),
QColor(Qt::darkRed),
QColor(Qt::darkGreen),
QColor(Qt::darkCyan),
QColor("#0000A0"),
QColor("#FF8000"),
QColor("#8000FF"),
QColor("#FF0080"),
QColor(Qt::white),
QColor(Qt::lightGray),
QColor(Qt::gray),
QColor("#FFFF80"),
QColor("#80FFFF"),
QColor("#FF80FF"),
QColor(Qt::darkGray),
}

Array containing the 24 predefined colors.

Referenced by colorList(), defaultColor(), and defaultColors().

const int ColorBox::colors_count = 24

static protected

The number of predefined colors.

Referenced by colorList(), defaultColors(), and numPredefinedColors().

The documentation for this class was generated from the following files:

- qtiplot/src/lib/include/ColorBox.h
- qtiplot/src/lib/src/ColorBox.cpp