• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KColorCollection Class Reference

Class for handling color collections ("palettes"). More...

#include <kcolorcollection.h>

List of all members.


Public Types

enum  Editable { Yes, No, Ask }

Public Member Functions

int addColor (const QColor &newColor, const QString &newColorName=QString())
int changeColor (const QColor &oldColor, const QColor &newColor, const QString &newColorName=QString())
int changeColor (int index, const QColor &newColor, const QString &newColorName=QString())
QColor color (int index) const
int count () const
QString description () const
Editable editable () const
int findColor (const QColor &color) const
 KColorCollection (const KColorCollection &)
 KColorCollection (const QString &name=QString())
QString name (const QColor &color) const
QString name (int index) const
QString name () const
KColorCollection & operator= (const KColorCollection &)
bool save ()
void setDescription (const QString &desc)
void setEditable (Editable editable)
void setName (const QString &name)
 ~KColorCollection ()

Static Public Member Functions

static QStringList installedCollections ()

Detailed Description

Class for handling color collections ("palettes").

This class makes it easy to handle color collections, sometimes referred to as "palettes". This class can read and write collections from and to a file.

This class uses the "GIMP" palette file format.

Author:
Waldo Bastian (bastian@kde.org)

Definition at line 42 of file kcolorcollection.h.


Member Enumeration Documentation

enum KColorCollection::Editable

Used to specify whether a collection may be edited.

See also:
editable()

setEditable()

Enumerator:
Yes  Collection may be edited.
No  Collection may not be edited.
Ask  Ask user before editing.

Definition at line 110 of file kcolorcollection.h.


Constructor & Destructor Documentation

KColorCollection::KColorCollection ( const QString &  name = QString()  )  [explicit]

KColorCollection constructor.

Creates a KColorCollection from a file the filename is derived from the name.

Parameters:
name The name of collection as returned by installedCollections()

Definition at line 124 of file kcolorcollection.cpp.

KColorCollection::KColorCollection ( const KColorCollection &  p  ) 

KColorCollection copy constructor.

Definition at line 129 of file kcolorcollection.cpp.

KColorCollection::~KColorCollection (  ) 

KColorCollection destructor.

Definition at line 134 of file kcolorcollection.cpp.


Member Function Documentation

int KColorCollection::addColor ( const QColor &  newColor,
const QString &  newColorName = QString() 
)

Add a color.

Parameters:
newColor The color to add.
newColorName The name of the color, null to remove the name.
Returns:
The index of the added color.

Definition at line 246 of file kcolorcollection.cpp.

int KColorCollection::changeColor ( const QColor &  oldColor,
const QColor &  newColor,
const QString &  newColorName = QString() 
)

Change a color.

Parameters:
oldColor The original color
newColor The new color.
newColorName The new color name, null to remove the name.
Returns:
The index of the new color or -1 if the color couldn't be changed.

Definition at line 267 of file kcolorcollection.cpp.

int KColorCollection::changeColor ( int  index,
const QColor &  newColor,
const QString &  newColorName = QString() 
)

Change a color.

Parameters:
index Index of the color to change
newColor The new color.
newColorName The new color name, null to remove the name.
Returns:
The index of the new color or -1 if the color couldn't be changed.

Definition at line 253 of file kcolorcollection.cpp.

QColor KColorCollection::color ( int  index  )  const

Find color by index.

Parameters:
index the index of the desired color
Returns:
The index -th color of the collection, null if not found.

Definition at line 212 of file kcolorcollection.cpp.

int KColorCollection::count (  )  const

Return the number of colors in the collection.

Returns:
the number of colors

Definition at line 195 of file kcolorcollection.cpp.

QString KColorCollection::description (  )  const

Get the description of the collection.

Returns:
the description of the collection.

Definition at line 165 of file kcolorcollection.cpp.

KColorCollection::Editable KColorCollection::editable (  )  const

Returns whether the collection may be edited.

Returns:
the state of the collection

Definition at line 185 of file kcolorcollection.cpp.

int KColorCollection::findColor ( const QColor &  color  )  const

Find index by color.

Parameters:
color the color to find
Returns:
The index of the color in the collection or -1 if the color is not found.

Definition at line 221 of file kcolorcollection.cpp.

QStringList KColorCollection::installedCollections (  )  [static]

Query which KDE color collections are installed.

Returns:
A list with installed color collection names.

Definition at line 108 of file kcolorcollection.cpp.

QString KColorCollection::name ( const QColor &  color  )  const

Find color name by color.

Returns:
The name of color according to this collection. Note that not all collections have named the colors. Note also that each collection can give the same color a different name.

Definition at line 240 of file kcolorcollection.cpp.

QString KColorCollection::name ( int  index  )  const

Find color name by index.

Parameters:
index the index of the color
Returns:
The name of the index -th color. Note that not all collections have named the colors. Null is returned if the color does not exist or has no name.

Definition at line 232 of file kcolorcollection.cpp.

QString KColorCollection::name (  )  const

Get the name of the collection.

Returns:
the name of the collection

Definition at line 175 of file kcolorcollection.cpp.

KColorCollection & KColorCollection::operator= ( const KColorCollection &  p  ) 

KColorCollection assignment operator.

Definition at line 201 of file kcolorcollection.cpp.

bool KColorCollection::save (  ) 

Save the collection.

Returns:
'true' if successful

Definition at line 141 of file kcolorcollection.cpp.

void KColorCollection::setDescription ( const QString &  desc  ) 

Set the description of the collection.

Parameters:
desc the new description

Definition at line 170 of file kcolorcollection.cpp.

void KColorCollection::setEditable ( Editable  editable  ) 

Change whether the collection may be edited.

Parameters:
editable the state of the collection

Definition at line 190 of file kcolorcollection.cpp.

void KColorCollection::setName ( const QString &  name  ) 

Set the name of the collection.

Parameters:
name the name of the collection

Definition at line 180 of file kcolorcollection.cpp.


The documentation for this class was generated from the following files:
  • kcolorcollection.h
  • kcolorcollection.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal