Pages
API Documentation
On this page

KColorCollection Class

This class is deprecated since 6.3. We strongly advise against using it in new code. More...

  • Header: #include <KColorCollection>
  • CMake: find_package(KF6 REQUIRED COMPONENTS GuiAddons)
    target_link_libraries(mytarget PRIVATE KF6::GuiAddons)
  • Status: Deprecated since 6.3

List of all members, including inherited members

Public Types

Public Functions

Static Public Members

This class is deprecated since 6.3. We strongly advise against using it in new code.

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.

Constant Value Description
KColorCollection::Yes 0 Collection may be edited
KColorCollection::No 1 Collection may not be edited
KColorCollection::Ask 2 Ask user before editing

See also editable(), 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

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.