Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSwatchGroup.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * SPDX-FileCopyrightText: 2005..2022 Halla Rempt <halla@valdyas.org>
4 * SPDX-FileCopyrightText: 2016 L. E. Segovia <amy@amyspark.me>
5 * SPDX-FileCopyrightText: 2018 Michael Zhou <simerixh@gmail.com>
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8
9#ifndef KISSWATCHGROUP_H
10#define KISSWATCHGROUP_H
11
12#include "KisSwatch.h"
13
14#include "kritapigment_export.h"
15
16#include <QSharedPointer>
17#include <QList>
18#include <QMap>
19
21
31class KRITAPIGMENT_EXPORT KisSwatchGroup
32{
33public /* struct */:
34 struct SwatchInfo {
35 QString group;
37 int row;
38 int column;
39 };
40
41public:
42
45
48 KisSwatchGroup &operator=(const KisSwatchGroup &rhs);
49
50 void setName(const QString &name);
51 QString name() const;
52
53 void setRowCount(int newRowCount);
54 int rowCount() const;
55
56 int colorCount() const;
57 int slotCount() const;
58
63 QList<SwatchInfo> infoList() const;
64
73 bool checkSwatchExists(int column, int row) const;
74
85 KisSwatch getSwatch(int column, int row) const;
86
87private:
88
89 friend class KoColorSet;
90 friend struct AddSwatchCommand;
91 friend struct RemoveGroupCommand;
92 friend struct RemoveSwatchCommand;
93 friend struct AddGroupCommand;
94 friend struct ClearCommand;
95 friend struct SetColumnCountCommand;
96 friend class TestKisSwatchGroup;
97 friend class TestKoColorSet;
98
99 // Hidden, you're supposed to go through KoColorSet or KisPaletteModel
101
102 friend class KisPaletteEditor; // Ew, gross! Refactor this when you understand what the PaletteEditor does...
103
111 void setSwatch(const KisSwatch &e, int column, int row);
112
120 bool removeSwatch(int column, int row);
121
131 QPair<int, int> addSwatch(const KisSwatch &e);
132
133 void clear();
134
135
136 void setColumnCount(int columnCount);
137 int columnCount() const;
138
143 struct Private;
145};
146
147inline QDebug operator<<(QDebug dbg, const KisSwatchGroup group)
148{
149 dbg.nospace() << "[Group] Name: " << group.name();
150 return dbg.space();
151}
152
154
155
156#endif // KISSWATCHGROUP_H
QDebug operator<<(QDebug dbg, const KisSwatchGroup group)
QSharedPointer< KisSwatchGroup > KisSwatchGroupSP
The PaletteEditor class this class manipulates a KisPaletteModel using GUI elements and communicates ...
The KisSwatchGroup class stores a matrix of color swatches swatches can accessed using (x,...
std::experimental::propagate_const< std::unique_ptr< Private > > d
static int DEFAULT_ROW_COUNT
static int DEFAULT_COLUMN_COUNT
QString name() const