KColorCollection
#include <KColorCollection.h>
Public Types | |
enum | Editable { Yes , No , Ask } |
Public Member Functions | |
KColorCollection (const KColorCollection &) | |
KColorCollection (const QString &name=QString()) | |
~KColorCollection () | |
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 |
QString | name () const |
QString | name (const QColor &color) const |
QString | name (int index) const |
KColorCollection & | operator= (const KColorCollection &) |
bool | save () |
void | setDescription (const QString &desc) |
void | setEditable (Editable editable) |
void | setName (const QString &name) |
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.
Definition at line 38 of file KColorCollection.h.
Member Enumeration Documentation
◆ 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 106 of file KColorCollection.h.
Constructor & Destructor Documentation
◆ KColorCollection() [1/2]
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 126 of file KColorCollection.cpp.
◆ KColorCollection() [2/2]
KColorCollection::KColorCollection | ( | const KColorCollection & | p | ) |
KColorCollection copy constructor.
Definition at line 131 of file KColorCollection.cpp.
◆ ~KColorCollection()
KColorCollection::~KColorCollection | ( | ) |
KColorCollection destructor.
Definition at line 136 of file KColorCollection.cpp.
Member Function Documentation
◆ addColor()
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 253 of file KColorCollection.cpp.
◆ changeColor() [1/2]
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 275 of file KColorCollection.cpp.
◆ changeColor() [2/2]
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 260 of file KColorCollection.cpp.
◆ color()
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 217 of file KColorCollection.cpp.
◆ count()
int KColorCollection::count | ( | ) | const |
Return the number of colors in the collection.
- Returns
- the number of colors
Definition at line 198 of file KColorCollection.cpp.
◆ description()
QString KColorCollection::description | ( | ) | const |
Get the description of the collection.
- Returns
- the description of the collection.
Definition at line 168 of file KColorCollection.cpp.
◆ editable()
KColorCollection::Editable KColorCollection::editable | ( | ) | const |
Returns whether the collection may be edited.
- Returns
- the state of the collection
Definition at line 188 of file KColorCollection.cpp.
◆ findColor()
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 227 of file KColorCollection.cpp.
◆ installedCollections()
|
static |
Query which KDE color collections are installed.
- Returns
- A list with installed color collection names.
Definition at line 111 of file KColorCollection.cpp.
◆ name() [1/3]
QString KColorCollection::name | ( | ) | const |
Get the name of the collection.
- Returns
- the name of the collection
Definition at line 178 of file KColorCollection.cpp.
◆ name() [2/3]
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 247 of file KColorCollection.cpp.
◆ name() [3/3]
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 238 of file KColorCollection.cpp.
◆ operator=()
KColorCollection & KColorCollection::operator= | ( | const KColorCollection & | p | ) |
KColorCollection assignment operator.
Definition at line 204 of file KColorCollection.cpp.
◆ save()
bool KColorCollection::save | ( | ) |
Save the collection.
- Returns
- 'true' if successful
Definition at line 143 of file KColorCollection.cpp.
◆ setDescription()
void KColorCollection::setDescription | ( | const QString & | desc | ) |
Set the description of the collection.
- Parameters
-
desc the new description
Definition at line 173 of file KColorCollection.cpp.
◆ setEditable()
void KColorCollection::setEditable | ( | Editable | editable | ) |
Change whether the collection may be edited.
- Parameters
-
editable the state of the collection
Definition at line 193 of file KColorCollection.cpp.
◆ setName()
void KColorCollection::setName | ( | const QString & | name | ) |
Set the name of the collection.
- Parameters
-
name the name of the collection
Definition at line 183 of file KColorCollection.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.