Changeset View
Changeset View
Standalone View
Standalone View
libs/widgets/KisPaletteModel.cpp
Context not available. | |||||
103 | { | 103 | { | ||
---|---|---|---|---|---|
104 | m_rowGroupNameMap.clear(); | 104 | m_rowGroupNameMap.clear(); | ||
105 | int row = -1; | 105 | int row = -1; | ||
106 | for (const QString &groupName : m_colorSet->getGroupNames()) { | 106 | for (const KisSwatchGroup &g : m_colorSet->getGroups()) { | ||
107 | m_rowGroupNameMap[row] = groupName; | 107 | m_rowGroupNameMap[row] = g.name(); | ||
108 | row += m_colorSet->getGroup(groupName)->rowCount(); | 108 | row += g.rowCount(); | ||
109 | row += 1; // row for group name | 109 | row += 1; // row for group name | ||
110 | } | 110 | } | ||
111 | } | 111 | } | ||
Context not available. | |||||
152 | 152 | | |||
153 | bool KisPaletteModel::addEntry(const KisSwatch &entry, const QString &groupName) | 153 | bool KisPaletteModel::addEntry(const KisSwatch &entry, const QString &groupName) | ||
154 | { | 154 | { | ||
155 | beginInsertRows(QModelIndex(), rowCount(), rowCount() + 1); | 155 | if (m_colorSet->getGroup(groupName)->colorCount() % | ||
156 | m_colorSet->add(entry, groupName); | 156 | m_colorSet->columnCount() == 0) { | ||
157 | endInsertRows(); | 157 | beginInsertRows(QModelIndex(), rowCount(), rowCount()); | ||
158 | m_colorSet->add(entry, groupName); | ||||
159 | endInsertRows(); | ||||
160 | } else { | ||||
161 | m_colorSet->add(entry, groupName); | ||||
162 | } | ||||
158 | if (m_colorSet->isGlobal()) { | 163 | if (m_colorSet->isGlobal()) { | ||
159 | m_colorSet->save(); | 164 | m_colorSet->save(); | ||
160 | } | 165 | } | ||
Context not available. |