27 #include <KDABLibFakes> 33 static Palette makeDefaultPalette() {
52 static Palette makeSubduedPalette() {
55 p.
addBrush( QColor( 0xe0,0x7f,0x70 ) );
56 p.
addBrush( QColor( 0xe2,0xa5,0x6f ) );
57 p.
addBrush( QColor( 0xe0,0xc9,0x70 ) );
58 p.
addBrush( QColor( 0xd1,0xe0,0x70 ) );
59 p.
addBrush( QColor( 0xac,0xe0,0x70 ) );
60 p.
addBrush( QColor( 0x86,0xe0,0x70 ) );
61 p.
addBrush( QColor( 0x70,0xe0,0x7f ) );
62 p.
addBrush( QColor( 0x70,0xe0,0xa4 ) );
63 p.
addBrush( QColor( 0x70,0xe0,0xc9 ) );
64 p.
addBrush( QColor( 0x70,0xd1,0xe0 ) );
65 p.
addBrush( QColor( 0x70,0xac,0xe0 ) );
66 p.
addBrush( QColor( 0x70,0x86,0xe0 ) );
67 p.
addBrush( QColor( 0x7f,0x70,0xe0 ) );
68 p.
addBrush( QColor( 0xa4,0x70,0xe0 ) );
69 p.
addBrush( QColor( 0xc9,0x70,0xe0 ) );
70 p.
addBrush( QColor( 0xe0,0x70,0xd1 ) );
71 p.
addBrush( QColor( 0xe0,0x70,0xac ) );
72 p.
addBrush( QColor( 0xe0,0x70,0x86 ) );
77 static Palette makeRainbowPalette() {
88 for (
int i = 8 ; i < 16 ; ++i ) {
98 class Palette::Private
101 explicit Private() {}
109 static const Palette palette = makeDefaultPalette();
115 static const Palette palette = makeSubduedPalette();
121 static const Palette palette = makeRainbowPalette();
126 :
QObject( parent ), _d( new Private )
139 :
QObject(), _d( new Private( *r.
d ) )
154 return d->brushes.size() >= 1;
159 return d->brushes.size();
164 if ( position < 0 || position >=
size() ) {
165 d->brushes.append( brush );
167 d->brushes.insert( position, brush );
174 if ( !
isValid() )
return QBrush();
175 return d->brushes.at( position %
size() );
180 if ( position < 0 || position >=
size() )
return;
181 d->brushes.remove( position );
A Palette is a set of brushes (or colors) to be used for painting data sets.
void addBrush(const QBrush &brush, int position=-1)
Adds brush to the palette.
static const Palette & rainbowPalette()
void removeBrush(int position)
Remove the brush at position position, if there is one.
static const Palette & defaultPalette()
Provide access to the three builtin palettes, one with standard bright colors, one with more subdued ...
void changed()
Emitted whenever the palette changes.
QBrush getBrush(int position) const
Query the palette for a brush at the specified position.
Palette(QObject *parent=0)
Palette & operator=(const Palette &)
Class only listed here to document inheritance of some KDChart classes.
static const Palette & subduedPalette()