| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Classes | Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Digikam::SetupCollectionModel Class Reference
Inheritance diagram for Digikam::SetupCollectionModel:

## Classes
class | Item

## Public Types
enum | Category { CategoryLocal = 0 , CategoryRemovable = 1 , CategoryRemote = 2 , NumberOfCategories }
enum | Columns { ColumnStatus = 0 , ColumnName = 1 , ColumnPath = 2 , ColumnAppendButton = 3 , ColumnUpdateButton = 4 , ColumnDeleteButton = 5 , NumberOfColumns }
enum | SetupCollectionDataRole { IsCategoryRole = Qt::UserRole , CategoryButtonDisplayRole = Qt::UserRole + 1 , CategoryButtonMapId = Qt::UserRole + 2 , IsAppendRole = Qt::UserRole + 3 , AppendDecorationRole = Qt::UserRole + 4 , AppendMapId = Qt::UserRole + 5 , IsUpdateRole = Qt::UserRole + 6 , UpdateDecorationRole = Qt::UserRole + 7 , UpdateMapId = Qt::UserRole + 8 , IsDeleteRole = Qt::UserRole + 9 , DeleteDecorationRole = Qt::UserRole + 10 , DeleteMapId = Qt::UserRole + 11 }
| SetupCollectionModel is a model specialized for use in SetupCollectionTreeView. More...

## Public Slots
void | slotAppendPressed (int mappedId)
| Forward button clicked signals to this slot.
void | slotCategoryButtonPressed (int mappedId)
| Forward category button clicked signals to this slot.
void | slotDeletePressed (int mappedId)
void | slotUpdatePressed (int mappedId)

## Signals
void | collectionsLoaded ()
| Emitted when all collections were loaded and the model reset in loadCollections.

## Public Member Functions
| SetupCollectionModel (QObject *const parent=nullptr)
| Internal data structure:
void | apply ()
| Apply the changed settings to CollectionManager.
QList< QModelIndex > | categoryIndexes () const
int | columnCount (const QModelIndex &parent=QModelIndex()) const override
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override
| QAbstractItemModel implementation.
Qt::ItemFlags | flags (const QModelIndex &index) const override
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex | indexForCategory (Category category) const
void | loadCollections ()
| Read collections from CollectionManager.
QModelIndex | parent (const QModelIndex &index) const override
int | rowCount (const QModelIndex &parent=QModelIndex()) const override
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
void | setParentWidgetForDialogs (QWidget *const widget)
| Set a widget used as parent for dialogs and message boxes.

## Public Attributes
QString | lastAddedCollectionPath

## Protected Slots
void | addCollection (int category)
void | deleteCollection (int internalId)
void | updateCollection (int internalId)

## Protected Member Functions
bool | askForNewCollectionCategory (int *const category)
bool | askForNewCollectionPath (bool adding, int category, QString *const newPath, QString *const newLabel)
int | buttonMapId (const QModelIndex &index) const
int | categoryButtonMapId (const QModelIndex &index) const
QModelIndex | indexForId (int id, int column) const

## Static Protected Member Functions
static Category | typeToCategory (CollectionLocation::Type type)

## Protected Attributes
QList< Item > | m_collections
QWidget * | m_dialogParentWidget = nullptr

## Member Enumeration Documentation

## ◆ SetupCollectionDataRole

enum Digikam::SetupCollectionModel::SetupCollectionDataRole

It provides a reads the current collections from CollectionManager, displays them in three categories, and supports adding and removing collections

Enumerator
IsCategoryRole | Returns true if the model index is the index of a category.
CategoryButtonDisplayRole | The text for the category button.
IsAppendRole | Returns true if the model index is the index of a button.
AppendDecorationRole | The pixmap of the button.
IsUpdateRole | Returns true if the model index is the index of a button.
UpdateDecorationRole | The pixmap of the button.
IsDeleteRole | Returns true if the model index is the index of a button.
DeleteDecorationRole | The pixmap of the button.

## Constructor & Destructor Documentation

## ◆ SetupCollectionModel()

Digikam::SetupCollectionModel::SetupCollectionModel | ( | QObject *const | parent = `nullptr` | ) |
| explicit

The category entries get a model index with INTERNALID and are identified by their row(). The item entries get the index in m_collections as INTERNALID. No item is ever removed from m_collections, deleted entries are only marked as such.

Items have a location, a parentId, and a name and label field. parentId always contains the category, needed to implement parent(). The location is the location if it exists, or is null if the item was added. Name and label are null if unchanged, then the values from location are used. They are valid if edited (label) or the location was added (both valid, location null).

## Member Function Documentation

## ◆ slotAppendPressed

void Digikam::SetupCollectionModel::slotAppendPressed | ( | int | mappedId | ) |
| slot

mappedId is retrieved with the ButtonMapId role for the model index of the button

## ◆ slotCategoryButtonPressed

void Digikam::SetupCollectionModel::slotCategoryButtonPressed | ( | int | mappedId | ) |
| slot

mappedId is retrieved with the CategoryButtonMapId role for the model index of the button