KColorCollection Class
Header: | #include <KColorCollection> |
CMake: | find_package(KF6 REQUIRED COMPONENTS GuiAddons) target_link_libraries(mytarget PRIVATE KF6::GuiAddons) |
Status: | Deprecated since 6.3 |
This class is deprecated since 6.3. We strongly advise against using it in new code.
Public Types
enum | Editable { Yes, No, Ask } |
Public Functions
KColorCollection(const QString &name = QString()) | |
KColorCollection(const KColorCollection &) | |
~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 |
KColorCollection::Editable | editable() const |
int | findColor(const QColor &color) const |
QString | name() const |
QString | name(const QColor &color) const |
QString | name(int index) const |
bool | save() |
void | setDescription(const QString &desc) |
void | setEditable(KColorCollection::Editable editable) |
void | setName(const QString &name) |
KColorCollection & | operator=(const KColorCollection &) |
Static Public Members
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.
Unused and backing data no longer available
Member Type Documentation
enum KColorCollection::Editable
Used to specify whether a collection may be edited.
See also editable() and setEditable().
Member Function Documentation
[explicit]
KColorCollection::KColorCollection(const QString &name = QString())
KColorCollection constructor. Creates a KColorCollection from a file the filename is derived from the name.
name The name of collection as returned by installedCollections()
KColorCollection::KColorCollection(const KColorCollection &)
KColorCollection copy constructor.
[noexcept]
KColorCollection::~KColorCollection()
KColorCollection destructor.
int KColorCollection::addColor(const QColor &newColor, const QString &newColorName = QString())
Add a color. newColor The color to add. newColorName The name of the color, null to remove the name. Returns The index of the added color.
int KColorCollection::changeColor(const QColor &oldColor, const QColor &newColor, const QString &newColorName = QString())
Change a color. 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.
int KColorCollection::changeColor(int index, const QColor &newColor, const QString &newColorName = QString())
Change a color. 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.
QColor KColorCollection::color(int index) const
Find color by index. index the index of the desired color Returns The index -th color of the collection, null if not found.
int KColorCollection::count() const
Return the number of colors in the collection. Returns the number of colors
QString KColorCollection::description() const
Get the description of the collection. Returns the description of the collection.
See also setDescription().
KColorCollection::Editable KColorCollection::editable() const
Returns whether the collection may be edited. Returns the state of the collection
See also setEditable().
int KColorCollection::findColor(const QColor &color) const
Find index by color. color the color to find Returns The index of the color in the collection or -1 if the color is not found.
[static]
QStringList KColorCollection::installedCollections()
Query which KDE color collections are installed.
Returns a list with installed color collection names.
QString KColorCollection::name() const
Get the name of the collection.
Returns the name of the collection
See also setName().
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.
QString KColorCollection::name(int index) const
Find color name by index. 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.
bool KColorCollection::save()
Save the collection
Returns true
if successful
void KColorCollection::setDescription(const QString &desc)
Set the description of the collection. desc the new description
See also description().
void KColorCollection::setEditable(KColorCollection::Editable editable)
Change whether the collection may be edited. editable the state of the collection
See also editable().
void KColorCollection::setName(const QString &name)
Set the name of the collection.
name the name of the collection
See also name().
KColorCollection &KColorCollection::operator=(const KColorCollection &)
KColorCollection assignment operator