# KDChart::Palette Class Reference

`#include <KDChartPalette.h>`

Inheritance diagram for KDChart::Palette:

[legend]
Collaboration diagram for KDChart::Palette:
[legend]
List of all members.

## Detailed Description

A Palette is a set of brushes (or colors) to be used for painting data sets.

The palette class encapsulates a colletion of brushes, which in the simplest case are colors, to be used for painting a series of data sets. When asked for the m-th color, a palette of size n will wrap around and thus cycle through the available colors.

Three builtin palettes are provided for convenience, one with a default set of colors, one with a subdued color selection, one with rainbow colors.

When a palette changes, it emits a changed() signal. Hook up to it, if you want to repaint when the color selection changes.

Definition at line 55 of file KDChartPalette.h.

## Public Member Functions

void | addBrush (const QBrush &brush, int position=-1)
| Adds brush to the palette.
QBrush | getBrush (int position) const
| Query the palette for a brush at the specified position.
bool | isValid () const
| Returns wether this represents a valid palette.
Palette & | operator= (const Palette &)
| Palette (const Palette &)
| Palette (QObject *parent=0)
void | removeBrush (int position)
| Remove the brush at position.
int | size () const
| Return the number of brushed in the palette.
| ~Palette ()

## Static Public Member Functions

const Palette & | defaultPalette ()
| Provide access to the three builtin palettes, one with standard bright colors, one with more subdued colors, and one with rainbow colors.
const Palette & | rainbowPalette ()
const Palette & | subduedPalette ()

## Public Attributes

Q_SIGNALS | __pad0__: void changed()

## Constructor & Destructor Documentation

KDChart::Palette::Palette | ( | QObject * | parent = 0 | ) | `[explicit]`

KDChart::Palette::Palette | ( | const Palette & |  | ) |

KDChart::Palette::~Palette | ( |  | ) |

## Member Function Documentation

void KDChart::Palette::addBrush | ( | const QBrush & | brush,
|  | int | position = -1
| ) |

| Adds brush to the palette. If no position is specified, the brush is appended. Referenced by makeDefaultPalette(), makeRainbowPalette(), and makeSubduedPalette().

const Palette& KDChart::Palette::defaultPalette | ( |  | ) | `[static]`

| Provide access to the three builtin palettes, one with standard bright colors, one with more subdued colors, and one with rainbow colors. Referenced by KDChart::AttributesModel::headerData().

QBrush KDChart::Palette::getBrush | ( | int | position | ) | const

| Query the palette for a brush at the specified position. If the position exceeds the size of the palette, it wraps around. Referenced by KDChart::AttributesModel::headerData(), and makeRainbowPalette().

bool KDChart::Palette::isValid | ( |  | ) | const

| Returns wether this represents a valid palette. For a palette to be valid it needs to have at least one brush associated.

Palette& KDChart::Palette::operator= | ( | const Palette & |  | ) |

const Palette& KDChart::Palette::rainbowPalette | ( |  | ) | `[static]`

| Referenced by KDChart::AttributesModel::headerData().

void KDChart::Palette::removeBrush | ( | int | position | ) |

Remove the brush at position.

Parameters:

  position,if | there is one.

int KDChart::Palette::size | ( |  | ) | const

| Return the number of brushed in the palette.

const Palette& KDChart::Palette::subduedPalette | ( |  | ) | `[static]`

| Referenced by KDChart::AttributesModel::headerData().

## Member Data Documentation

Q_SIGNALS KDChart::Palette::__pad0__

| Definition at line 94 of file KDChartPalette.h.

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

- KDChartPalette.h