Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Private Attributes
color_widgets::ColorPalette Class Reference

#include <color_palette.hpp>

List of all members.

Classes

class  Private

Public Types

typedef QPair< QColor, QString > value_type

Public Slots

void appendColor (const QColor &color, const QString &name=QString())
 Append a color at the end.
void eraseColor (int index)
 Remove the color at the given index.
void insertColor (int index, const QColor &color, const QString &name=QString())
 Insert a color in an arbitrary location.
bool save (const QString &filename)
 Change file name and save.
bool save ()
 save to file, the filename is fileName or determined automatically
void setColorAt (int index, const QColor &color)
 Change the color at the given index.
void setColorAt (int index, const QColor &color, const QString &name)
 Change the color at the given index.
void setColors (const QVector< QColor > &colors)
void setColors (const QVector< QPair< QColor, QString > > &colors)
void setColumns (int columns)
void setDirty (bool dirty)
void setFileName (const QString &name)
void setName (const QString &name)
void setNameAt (int index, const QString &name=QString())
 Change the name of a color.

Signals

void colorAdded (int index)
 Emitted when a single color has been added.
void colorChanged (int index)
 Emitted when the color or the name at the given index has been modified.
void colorRemoved (int index)
 Emitted when the color at the given index has been removed.
void colorsChanged (const QVector< QPair< QColor, QString > > &)
 Emitted when all the colors have changed.
void colorsUpdated (const QVector< QPair< QColor, QString >> &)
 Emitted when the colors have been modified with a simple operation (set, append etc.)
void columnsChanged (int)
void dirtyChanged (bool)
void fileNameChanged (const QString &)
void nameChanged (const QString &)

Public Member Functions

Q_INVOKABLE QColor colorAt (int index) const
 Color at the given index.
 ColorPalette (const QVector< QColor > &colors, const QString &name=QString(), int columns=0)
 ColorPalette (const QVector< QPair< QColor, QString > > &colors, const QString &name=QString(), int columns=0)
 ColorPalette (const QString &name=QString())
 ColorPalette (const ColorPalette &other)
 ColorPalette (ColorPalette &&other)
QVector< QPair< QColor, QString > > colors () const
Q_INVOKABLE QVector< QRgb > colorTable () const
 Convert to a color table.
int columns ()
int count () const
bool dirty () const
QString fileName () const
Q_INVOKABLE bool load (const QString &name)
 Load contents from a Gimp palette (gpl) file.
Q_INVOKABLE void loadColorTable (const QVector< QRgb > &color_table)
 Use a color table to set the colors.
Q_INVOKABLE bool loadImage (const QImage &image)
 Use the pixels on an image to set the palette colors.
QString name () const
Q_INVOKABLE QString nameAt (int index) const
 Color name at the given index.
QVector< QColor > onlyColors () const
ColorPaletteoperator= (const ColorPalette &other)
ColorPaletteoperator= (ColorPalette &&other)
QPixmap preview (const QSize &size, const QColor &background=Qt::transparent) const
 Returns a preview image of the colors in the palette.
 ~ColorPalette ()

Static Public Member Functions

static ColorPalette fromColorTable (const QVector< QRgb > &table)
 Creates a ColorPalette from a color table.
static ColorPalette fromFile (const QString &name)
 Creates a ColorPalette from a Gimp palette (gpl) file.
static ColorPalette fromImage (const QImage &image)
 Creates a ColorPalette from a Gimp palette (gpl) file.

Properties

QVector< value_typecolors
 The list of colors.
int columns
 Number of colors to display in a row, if 0 unspecified.
int count
 Number of colors.
bool dirty
 Whether it has been modified and it might be advisable to save it.
QString fileName
 Name of the file the palette has been read from.
QString name
 Name of the palette.

Private Member Functions

void emitUpdate ()
 Emit all the necessary signals when the palette has been completely overwritten.
QString unnamed (const QString &name=QString()) const
 Returns name if it isn't null, otherwise a default value.

Private Attributes

Privatep

Detailed Description

Definition at line 34 of file color_palette.hpp.


Member Typedef Documentation

typedef QPair<QColor,QString> color_widgets::ColorPalette::value_type

Definition at line 64 of file color_palette.hpp.


Constructor & Destructor Documentation

color_widgets::ColorPalette::ColorPalette ( const QVector< QColor > &  colors,
const QString &  name = QString(),
int  columns = 0 
)

Definition at line 47 of file color_palette.cpp.

color_widgets::ColorPalette::ColorPalette ( const QVector< QPair< QColor, QString > > &  colors,
const QString &  name = QString(),
int  columns = 0 
)

Definition at line 65 of file color_palette.cpp.

color_widgets::ColorPalette::ColorPalette ( const QString &  name = QString()) [explicit]

Definition at line 57 of file color_palette.cpp.

Definition at line 75 of file color_palette.cpp.

Definition at line 87 of file color_palette.cpp.

Definition at line 92 of file color_palette.cpp.


Member Function Documentation

void color_widgets::ColorPalette::appendColor ( const QColor &  color,
const QString &  name = QString() 
) [slot]

Append a color at the end.

Definition at line 382 of file color_palette.cpp.

void color_widgets::ColorPalette::colorAdded ( int  index) [signal]

Emitted when a single color has been added.

QColor color_widgets::ColorPalette::colorAt ( int  index) const

Color at the given index.

Definition at line 113 of file color_palette.cpp.

void color_widgets::ColorPalette::colorChanged ( int  index) [signal]

Emitted when the color or the name at the given index has been modified.

void color_widgets::ColorPalette::colorRemoved ( int  index) [signal]

Emitted when the color at the given index has been removed.

QVector<QPair<QColor,QString> > color_widgets::ColorPalette::colors ( ) const
void color_widgets::ColorPalette::colorsChanged ( const QVector< QPair< QColor, QString > > &  ) [signal]

Emitted when all the colors have changed.

void color_widgets::ColorPalette::colorsUpdated ( const QVector< QPair< QColor, QString >> &  ) [signal]

Emitted when the colors have been modified with a simple operation (set, append etc.)

QVector< QRgb > color_widgets::ColorPalette::colorTable ( ) const

Convert to a color table.

Definition at line 482 of file color_palette.cpp.

Emit all the necessary signals when the palette has been completely overwritten.

Definition at line 104 of file color_palette.cpp.

void color_widgets::ColorPalette::eraseColor ( int  index) [slot]

Remove the color at the given index.

Definition at line 402 of file color_palette.cpp.

void color_widgets::ColorPalette::fileNameChanged ( const QString &  ) [signal]
ColorPalette color_widgets::ColorPalette::fromColorTable ( const QVector< QRgb > &  table) [static]

Creates a ColorPalette from a color table.

Definition at line 491 of file color_palette.cpp.

ColorPalette color_widgets::ColorPalette::fromFile ( const QString &  name) [static]

Creates a ColorPalette from a Gimp palette (gpl) file.

Definition at line 258 of file color_palette.cpp.

ColorPalette color_widgets::ColorPalette::fromImage ( const QImage &  image) [static]

Creates a ColorPalette from a Gimp palette (gpl) file.

Definition at line 179 of file color_palette.cpp.

void color_widgets::ColorPalette::insertColor ( int  index,
const QColor &  color,
const QString &  name = QString() 
) [slot]

Insert a color in an arbitrary location.

Definition at line 390 of file color_palette.cpp.

bool color_widgets::ColorPalette::load ( const QString &  name)

Load contents from a Gimp palette (gpl) file.

Returns:
true On Success
Note:
If this function returns false, the palette will become empty
Todo:
Store extra properties in the palette object

Definition at line 186 of file color_palette.cpp.

void color_widgets::ColorPalette::loadColorTable ( const QVector< QRgb > &  color_table)

Use a color table to set the colors.

Definition at line 143 of file color_palette.cpp.

bool color_widgets::ColorPalette::loadImage ( const QImage &  image)

Use the pixels on an image to set the palette colors.

Definition at line 157 of file color_palette.cpp.

QString color_widgets::ColorPalette::nameAt ( int  index) const

Color name at the given index.

Definition at line 118 of file color_palette.cpp.

void color_widgets::ColorPalette::nameChanged ( const QString &  ) [signal]
QVector< QColor > color_widgets::ColorPalette::onlyColors ( ) const

Definition at line 473 of file color_palette.cpp.

ColorPalette & color_widgets::ColorPalette::operator= ( const ColorPalette other)

Definition at line 80 of file color_palette.cpp.

ColorPalette & color_widgets::ColorPalette::operator= ( ColorPalette &&  other)

Definition at line 97 of file color_palette.cpp.

QPixmap color_widgets::ColorPalette::preview ( const QSize &  size,
const QColor &  background = Qt::transparent 
) const

Returns a preview image of the colors in the palette.

Definition at line 432 of file color_palette.cpp.

bool color_widgets::ColorPalette::save ( const QString &  filename) [slot]

Change file name and save.

Returns:
true on success

Definition at line 265 of file color_palette.cpp.

save to file, the filename is fileName or determined automatically

Returns:
true on success
Todo:
Options to add comments

Definition at line 271 of file color_palette.cpp.

void color_widgets::ColorPalette::setColorAt ( int  index,
const QColor &  color 
) [slot]

Change the color at the given index.

Definition at line 345 of file color_palette.cpp.

void color_widgets::ColorPalette::setColorAt ( int  index,
const QColor &  color,
const QString &  name 
) [slot]

Change the color at the given index.

Definition at line 357 of file color_palette.cpp.

void color_widgets::ColorPalette::setColors ( const QVector< QColor > &  colors) [slot]

Definition at line 328 of file color_palette.cpp.

void color_widgets::ColorPalette::setColors ( const QVector< QPair< QColor, QString > > &  colors) [slot]

Definition at line 337 of file color_palette.cpp.

void color_widgets::ColorPalette::setColumns ( int  columns) [slot]

Definition at line 316 of file color_palette.cpp.

Definition at line 467 of file color_palette.cpp.

void color_widgets::ColorPalette::setFileName ( const QString &  name) [slot]

Definition at line 420 of file color_palette.cpp.

void color_widgets::ColorPalette::setName ( const QString &  name) [slot]

Definition at line 414 of file color_palette.cpp.

void color_widgets::ColorPalette::setNameAt ( int  index,
const QString &  name = QString() 
) [slot]

Change the name of a color.

Definition at line 369 of file color_palette.cpp.

QString color_widgets::ColorPalette::unnamed ( const QString &  name = QString()) const [private]

Returns name if it isn't null, otherwise a default value.

Definition at line 426 of file color_palette.cpp.


Member Data Documentation

Definition at line 222 of file color_palette.hpp.


Property Documentation

QVector< QPair< QColor, QString > > color_widgets::ColorPalette::colors [read, write]

The list of colors.

Definition at line 41 of file color_palette.hpp.

Number of colors to display in a row, if 0 unspecified.

Definition at line 49 of file color_palette.hpp.

Number of colors.

Definition at line 53 of file color_palette.hpp.

Whether it has been modified and it might be advisable to save it.

Definition at line 61 of file color_palette.hpp.

Name of the file the palette has been read from.

Definition at line 57 of file color_palette.hpp.

QString color_widgets::ColorPalette::name [read, write]

Name of the palette.

Definition at line 45 of file color_palette.hpp.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Wed Jul 3 2019 19:28:06