47 Q_ASSERT(column < d->colorMatrix.size() &&
column >= 0 &&
row >= 0);
49 if (
row + 1 >=
d->rowCount) {
60 if (
row >=
d->rowCount) {
64 if (
column >=
d->colorMatrix.size()){
85 if (
d->colorCount == 0) {
108 QVector <KisSwatch> movedSwatches;
110 for (
int r = 0; r <
rowCount(); r++ ) {
111 for (
int c = 0; c <
d->colorMatrix.size(); c++ ) {
114 movedSwatches.push_back(
getSwatch(c, r));
118 if ( !movedSwatches.isEmpty()) {
119 for (
int i = 0; i< movedSwatches.size(); i++) {
122 d->colorMatrix[c][r] = movedSwatches.at(i);
130 if (columnCount < d->colorMatrix.size()) {
131 int newColorCount = 0;
133 newColorCount +=
d->colorMatrix[i].size();
135 d->colorCount = newColorCount;
141 return d->colorMatrix.size();
166 if(++x ==
d->colorMatrix.size())
177 return QPair<int, int> (x, y);
182 d->colorMatrix.clear();
187 d->rowCount = newRowCount;
189 for (
int k : c.keys()) {
190 if (k >= newRowCount) {
205 return d->colorCount;
220 SwatchInfo info = {
d->name, s, c.keys()[i++],
column};
The KisSwatchGroup class stores a matrix of color swatches swatches can accessed using (x,...
std::experimental::propagate_const< std::unique_ptr< Private > > d
KisSwatchGroup & operator=(const KisSwatchGroup &rhs)
static int DEFAULT_ROW_COUNT
bool checkSwatchExists(int column, int row) const
checkSwatch checks if position column and row has a valid entry both column and row start from 0
QList< SwatchInfo > infoList() const
getColors
void setName(const QString &name)
void setSwatch(const KisSwatch &e, int column, int row)
setSwatch sets the entry at position (column, row) to be e
KisSwatch getSwatch(int column, int row) const
getSwatch used to get the swatch entry at position (column, row) there is an assertion to make sure t...
void setColumnCount(int columnCount)
static int DEFAULT_COLUMN_COUNT
QPair< int, int > addSwatch(const KisSwatch &e)
addEntry adds the entry e to the right of the rightmost entry in the last row if the rightmost entry ...
void setRowCount(int newRowCount)
bool removeSwatch(int column, int row)
removeSwatch removes the entry at position (column, row)
void clearMetadata()
clearMetadata clear th metadata map inside the KoColor.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
QVector< Column > colorMatrix
QMap< int, KisSwatch > Column