KGuiAddons 5.109.0
kcolorcollection.h
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 1999 Waldo Bastian <bastian@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7// KDE color collection.
8
9#ifndef KDELIBS_KCOLORCOLLECTION_H
10#define KDELIBS_KCOLORCOLLECTION_H
11
12#include <kguiaddons_export.h>
13
14#include <QColor>
15#include <QSharedDataPointer>
16#include <QString>
17#include <QStringList>
18
31class KGUIADDONS_EXPORT KColorCollection
32{
33public:
39 static QStringList installedCollections();
40
46 explicit KColorCollection(const QString &name = QString());
47
52
57
62
68 bool save();
69
74 QString description() const;
75
80 void setDescription(const QString &desc);
81
86 QString name() const;
87
92 void setName(const QString &name);
93
99 enum Editable {
103 };
104
110
115 void setEditable(Editable editable);
116
121 int count() const;
122
128 QColor color(int index) const;
129
136 int findColor(const QColor &color) const;
137
145 QString name(int index) const;
146
154 QString name(const QColor &color) const;
155
163 int addColor(const QColor &newColor, const QString &newColorName = QString());
164
174 int changeColor(int index, const QColor &newColor, const QString &newColorName = QString());
175
185 int changeColor(const QColor &oldColor, const QColor &newColor, const QString &newColorName = QString());
186
187private:
188 QSharedDataPointer<class KColorCollectionPrivate> d;
189};
190
191#endif // KDELIBS_KCOLORCOLLECTION_H
Class for handling color collections ("palettes").
Definition kcolorcollection.h:32
int count() const
Return the number of colors in the collection.
int changeColor(const QColor &oldColor, const QColor &newColor, const QString &newColorName=QString())
Change a color.
KColorCollection & operator=(const KColorCollection &)
KColorCollection assignment operator.
void setName(const QString &name)
Set the name of the collection.
QString name() const
Get the name of the collection.
static QStringList installedCollections()
Query which KDE color collections are installed.
QString name(const QColor &color) const
Find color name by color.
Editable editable() const
Returns whether the collection may be edited.
int changeColor(int index, const QColor &newColor, const QString &newColorName=QString())
Change a color.
QString name(int index) const
Find color name by index.
void setDescription(const QString &desc)
Set the description of the collection.
~KColorCollection()
KColorCollection destructor.
QString description() const
Get the description of the collection.
QColor color(int index) const
Find color by index.
void setEditable(Editable editable)
Change whether the collection may be edited.
KColorCollection(const KColorCollection &)
KColorCollection copy constructor.
KColorCollection(const QString &name=QString())
KColorCollection constructor.
int findColor(const QColor &color) const
Find index by color.
int addColor(const QColor &newColor, const QString &newColorName=QString())
Add a color.
bool save()
Save the collection.
Editable
Used to specify whether a collection may be edited.
Definition kcolorcollection.h:99
@ Ask
Ask user before editing.
Definition kcolorcollection.h:102
@ Yes
Collection may be edited.
Definition kcolorcollection.h:100
@ No
Collection may not be edited.
Definition kcolorcollection.h:101