|
Krita Source Code Documentation
|
The KisPaletteModel class This, together with KisPaletteView and KisPaletteDelegate forms a mvc way to access kocolorsets. A display renderer is given to this model to convert KoColor to QColor when colors are requested. More...
#include <KisPaletteModel.h>
Inheritance diagram for KisPaletteModel:Public Types | |
| enum | AdditionalRoles { IsGroupNameRole = Qt::UserRole + 1 , CheckSlotRole , GroupNameRole , RowInGroupRole } |
Signals | |
| void | sigPaletteChanged () |
| sigPaletteChanged emitted when the palette associated with the model is changed for another palette | |
| void | sigPaletteModified () |
| sigPaletteModified emitted when palette associated with the model is modified | |
Public Member Functions | |
| KisSwatchGroupSP | addGroup (const QString &groupName, int columnCount=KisSwatchGroup::DEFAULT_COLUMN_COUNT, int rowCount=KisSwatchGroup::DEFAULT_ROW_COUNT) |
| void | addSwatch (const KisSwatch &entry, const QString &groupName=KoColorSet::GLOBAL_GROUP_NAME) |
| void | changeGroupName (const QString &groupName, const QString &newName) |
| void | clear () |
| void | clear (int defaultColumnsCount) |
| KoColorSetSP | colorSet () const |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| KisSwatch | getSwatch (const QModelIndex &index) const |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| QModelIndex | indexForClosest (const KoColor &compare) |
| KisPaletteModel (QObject *parent=0) | |
| QMimeData * | mimeData (const QModelIndexList &indexes) const override |
| QStringList | mimeTypes () const override |
| void | removeGroup (const QString &groupName, bool keepColors) |
| void | removeSwatch (const QModelIndex &index, bool keepColors=true) |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| void | setColorSet (KoColorSetSP colorSet) |
| void | setColumnCount (int colCount) |
| void | setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer) |
| void | setRowCountForGroup (const QString &groupName, int rowCount) |
| void | setSwatch (const KisSwatch &entry, const QModelIndex &index) |
| void | slotExternalPaletteModified (QSharedPointer< KoColorSet > resource) |
| Qt::DropActions | supportedDropActions () const override |
| ~KisPaletteModel () override | |
Private Slots | |
| void | slotDisplayConfigurationChanged () |
| void | slotEntryChanged (int column, int row) |
| void | slotLayoutAboutToChange () |
| void | slotLayoutChanged () |
| void | slotPaletteModified () |
Private Member Functions | |
| QVariant | dataForGroupNameRow (const QModelIndex &idx, int role) const |
| QVariant | dataForSwatch (const QModelIndex &idx, int role) const |
| int | indexRowForInfo (const KisSwatchGroup::SwatchInfo &info) |
| int | rowNumberInGroup (int rowInModel) const |
Private Attributes | |
| : KoColorSetSP m_colorSet | |
| QPointer< const KoColorDisplayRendererInterface > | m_displayRenderer |
| bool | m_editing {false} |
Friends | |
| class | TestKisPaletteModel |
The KisPaletteModel class This, together with KisPaletteView and KisPaletteDelegate forms a mvc way to access kocolorsets. A display renderer is given to this model to convert KoColor to QColor when colors are requested.
Definition at line 27 of file KisPaletteModel.h.
| Enumerator | |
|---|---|
| IsGroupNameRole | |
| CheckSlotRole | |
| GroupNameRole | |
| RowInGroupRole | |
Definition at line 42 of file KisPaletteModel.h.
|
explicit |
Definition at line 25 of file KisPaletteModel.cpp.
References connect(), sigPaletteModified(), and slotPaletteModified().
|
override |
Definition at line 33 of file KisPaletteModel.cpp.
| KisSwatchGroupSP KisPaletteModel::addGroup | ( | const QString & | groupName, |
| int | columnCount = KisSwatchGroup::DEFAULT_COLUMN_COUNT, | ||
| int | rowCount = KisSwatchGroup::DEFAULT_ROW_COUNT ) |
Definition at line 299 of file KisPaletteModel.cpp.
References m_editing, and rowCount().
| void KisPaletteModel::addSwatch | ( | const KisSwatch & | entry, |
| const QString & | groupName = KoColorSet::GLOBAL_GROUP_NAME ) |
Definition at line 135 of file KisPaletteModel.cpp.
References rowCount().
| void KisPaletteModel::changeGroupName | ( | const QString & | groupName, |
| const QString & | newName ) |
Definition at line 291 of file KisPaletteModel.cpp.
References m_editing.
| void KisPaletteModel::clear | ( | ) |
Definition at line 324 of file KisPaletteModel.cpp.
| void KisPaletteModel::clear | ( | int | defaultColumnsCount | ) |
Definition at line 329 of file KisPaletteModel.cpp.
References m_editing.
| KoColorSetSP KisPaletteModel::colorSet | ( | ) | const |
Definition at line 124 of file KisPaletteModel.cpp.
|
override |
Definition at line 57 of file KisPaletteModel.cpp.
|
override |
Definition at line 37 of file KisPaletteModel.cpp.
References dataForGroupNameRow(), dataForSwatch(), index(), and IsGroupNameRole.
|
private |
Definition at line 338 of file KisPaletteModel.cpp.
References CheckSlotRole, GroupNameRole, and RowInGroupRole.
|
private |
Definition at line 363 of file KisPaletteModel.cpp.
References CheckSlotRole, KisSwatch::color(), GroupNameRole, m_displayRenderer, KisSwatch::name(), RowInGroupRole, rowNumberInGroup(), and KoColor::toQString().
|
override |
Definition at line 170 of file KisPaletteModel.cpp.
References CheckSlotRole, data(), KisSwatch::fromByteArray(), getSwatch(), KoColorSet::GLOBAL_GROUP_NAME, GroupNameRole, IsGroupNameRole, m_editing, and setSwatch().
|
override |
Definition at line 68 of file KisPaletteModel.cpp.
References index().
| KisSwatch KisPaletteModel::getSwatch | ( | const QModelIndex & | index | ) | const |
|
override |
Definition at line 80 of file KisPaletteModel.cpp.
References columnCount(), and rowCount().
| QModelIndex KisPaletteModel::indexForClosest | ( | const KoColor & | compare | ) |
Definition at line 467 of file KisPaletteModel.cpp.
References colorSet(), and indexRowForInfo().
|
private |
Definition at line 473 of file KisPaletteModel.cpp.
|
override |
Definition at line 239 of file KisPaletteModel.cpp.
References CheckSlotRole, getSwatch(), GroupNameRole, index(), IsGroupNameRole, mimeData(), rowNumberInGroup(), and KisSwatch::writeToStream().
|
override |
Definition at line 266 of file KisPaletteModel.cpp.
| void KisPaletteModel::removeGroup | ( | const QString & | groupName, |
| bool | keepColors ) |
Definition at line 159 of file KisPaletteModel.cpp.
References m_editing.
| void KisPaletteModel::removeSwatch | ( | const QModelIndex & | index, |
| bool | keepColors = true ) |
Definition at line 142 of file KisPaletteModel.cpp.
References data(), index(), IsGroupNameRole, removeGroup(), and rowNumberInGroup().
|
override |
Definition at line 51 of file KisPaletteModel.cpp.
|
private |
Definition at line 129 of file KisPaletteModel.cpp.
| void KisPaletteModel::setColorSet | ( | KoColorSetSP | colorSet | ) |
Definition at line 103 of file KisPaletteModel.cpp.
References colorSet(), connect(), sigPaletteChanged(), sigPaletteModified(), slotEntryChanged(), slotLayoutAboutToChange(), and slotLayoutChanged().
| void KisPaletteModel::setColumnCount | ( | int | colCount | ) |
Definition at line 319 of file KisPaletteModel.cpp.
| void KisPaletteModel::setDisplayRenderer | ( | const KoColorDisplayRendererInterface * | displayRenderer | ) |
Installs a display renderer object for a palette that will convert the KoColor to the displayable QColor. Default is the dumb renderer.
Definition at line 400 of file KisPaletteModel.cpp.
References connect(), KoDumbColorDisplayRenderer::instance(), m_displayRenderer, and slotDisplayConfigurationChanged().
| void KisPaletteModel::setRowCountForGroup | ( | const QString & | groupName, |
| int | rowCount ) |
Definition at line 308 of file KisPaletteModel.cpp.
References m_editing, and rowCount().
Definition at line 276 of file KisPaletteModel.cpp.
References columnCount(), index(), and rowNumberInGroup().
|
signal |
sigPaletteChanged emitted when the palette associated with the model is changed for another palette
|
signal |
sigPaletteModified emitted when palette associated with the model is modified
|
privateslot |
Definition at line 414 of file KisPaletteModel.cpp.
|
privateslot |
| void KisPaletteModel::slotExternalPaletteModified | ( | QSharedPointer< KoColorSet > | resource | ) |
Definition at line 459 of file KisPaletteModel.cpp.
References slotDisplayConfigurationChanged(), and slotPaletteModified().
|
privateslot |
Definition at line 438 of file KisPaletteModel.cpp.
References m_editing.
|
privateslot |
Definition at line 446 of file KisPaletteModel.cpp.
References m_editing.
|
privateslot |
Until we implement resource->convertToSerializable() we should explicitly convert all the palettes into Krita internal format
Definition at line 420 of file KisPaletteModel.cpp.
References KoColorSet::GPL, and KoColorSet::KPL.
|
override |
Definition at line 271 of file KisPaletteModel.cpp.
|
friend |
Definition at line 129 of file KisPaletteModel.h.
|
private |
Definition at line 135 of file KisPaletteModel.h.
|
private |
Definition at line 139 of file KisPaletteModel.h.
|
private |
Definition at line 140 of file KisPaletteModel.h.