digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ItemAlbumModel Class Reference
Inheritance diagram for Digikam::ItemAlbumModel:

Public Slots

void openAlbum (const QList< Album * > &albums)
 Call this method to populate the model with data from the given album.
void refresh ()
 Reloads the current album.
void setListOnlyAvailableImages (bool onlyAvailable)
void setRecurseAlbums (bool recursiveListing)
void setRecurseTags (bool recursiveListing)
void setSpecialTagListing (const QString &specialListing)
Public Slots inherited from Digikam::ItemThumbnailModel
void preloadAllThumbnails ()
void preloadThumbnails (const QList< ItemInfo > &)
 Preload thumbnail for the given infos resp.
void preloadThumbnails (const QList< QModelIndex > &)
Public Slots inherited from Digikam::ItemModel
void reAddingFinished ()
void reAddItemInfos (const QList< ItemInfo > &infos, const QList< QVariant > &extraValues)

Public Member Functions

 ItemAlbumModel (QWidget *const parent)
QList< Album * > currentAlbums () const
bool hasScheduledRefresh () const
bool isListingOnlyAvailableImages () const
bool isRecursingAlbums () const
bool isRecursingTags () const
Public Member Functions inherited from Digikam::ItemThumbnailModel
 ItemThumbnailModel (QWidget *const parent)
 An ItemModel that supports thumbnail loading.
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Handles the ThumbnailRole.
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
 You can override the current thumbnail size by giving an integer value for ThumbnailRole.
void setEmitDataChanged (bool emitSignal)
 Enable emitting dataChanged() when a thumbnail becomes available.
void setExifRotate (bool rotate)
void setPreloadThumbnails (bool preload)
 Enable preloading of thumbnails: If preloading is enabled, for every entry in the model a thumbnail generation is started.
void setPreloadThumbnailSize (const ThumbnailSize &thumbSize)
 If you want to fix a size for preloading, do it here.
void setThumbnailLoadThread (ThumbnailLoadThread *const thread)
 Enable thumbnail loading and set the thread that shall be used.
void setThumbnailSize (const ThumbnailSize &thumbSize)
 Set the thumbnail size to use.
ThumbnailLoadThread * thumbnailLoadThread () const
ThumbnailSize thumbnailSize () const
Public Member Functions inherited from Digikam::ItemModel
 ItemModel (QObject *const parent=nullptr)
void addItemInfo (const ItemInfo &info)
 Main entry point for subclasses adding image infos to the model.
void addItemInfos (const QList< ItemInfo > &infos)
void addItemInfos (const QList< ItemInfo > &infos, const QList< QVariant > &extraValues)
void addItemInfosSynchronously (const QList< ItemInfo > &infos)
void addItemInfosSynchronously (const QList< ItemInfo > &infos, const QList< QVariant > &extraValues)
void addItemInfoSynchronously (const ItemInfo &info)
 addItemInfo() is asynchronous if a prepocessor is set.
void clearItemInfos ()
 Clears image infos and resets model.
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
void ensureHasGroupedImages (const ItemInfo &groupLeader)
 Ensure that all images grouped on the given leader are contained in the model.
void ensureHasItemInfo (const ItemInfo &info)
 Add the given entries.
void ensureHasItemInfos (const QList< ItemInfo > &infos)
void ensureHasItemInfos (const QList< ItemInfo > &infos, const QList< QVariant > &extraValues)
Qt::ItemFlags flags (const QModelIndex &index) const override
bool hasImage (const ItemInfo &info) const
bool hasImage (const ItemInfo &info, const QVariant &extraValue) const
bool hasImage (qlonglong id) const
bool hasImage (qlonglong id, const QVariant &extraValue) const
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
qlonglong imageId (const QModelIndex &index) const
qlonglong imageId (int row) const
QList< qlonglong > imageIds () const
QList< qlonglong > imageIds (const QList< QModelIndex > &indexes) const
ItemInfo imageInfo (const QModelIndex &index) const
ItemInfo imageInfo (const QString &filePath) const
ItemInfo imageInfo (int row) const
ItemInfo & imageInfoRef (const QModelIndex &index) const
ItemInfo & imageInfoRef (int row) const
QList< ItemInfo > imageInfos () const
QList< ItemInfo > imageInfos (const QList< QModelIndex > &indexes) const
QList< ItemInfo > imageInfos (const QString &filePath) const
QModelIndex index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
QList< QModelIndex > indexesForImageId (qlonglong id) const
QList< QModelIndex > indexesForItemInfo (const ItemInfo &info) const
QList< QModelIndex > indexesForPath (const QString &filePath) const
QModelIndex indexForImageId (qlonglong id) const
QModelIndex indexForImageId (qlonglong id, const QVariant &extraValue) const
QModelIndex indexForItemInfo (const ItemInfo &info) const
QModelIndex indexForItemInfo (const ItemInfo &info, const QVariant &extraValue) const
QModelIndex indexForPath (const QString &filePath) const
bool isEmpty () const
bool isRefreshing () const
int itemCount () const
bool keepsFilePathCache () const
int numberOfIndexesForImageId (qlonglong id) const
int numberOfIndexesForItemInfo (const ItemInfo &info) const
void removeIndex (const QModelIndex &indexes)
 Directly remove the given indexes or infos from the model.
void removeIndexes (const QList< QModelIndex > &indexes)
void removeItemInfo (const ItemInfo &info)
void removeItemInfos (const QList< ItemInfo > &infos)
void removeItemInfos (const QList< ItemInfo > &infos, const QList< QVariant > &extraValues)
int rowCount (const QModelIndex &parent=QModelIndex()) const override
void setItemInfos (const QList< ItemInfo > &infos)
 Clears and adds the infos.
void setKeepsFilePathCache (bool keepCache)
 If a cache is kept, lookup by file path is fast, without a cache it is O(n).
DECLARE_MODEL_DRAG_DROP_METHODS void setPreprocessor (QObject *const processor)
 Install an object as a preprocessor for ItemInfos added to this model.
void setSendRemovalSignals (bool send)
 Enable sending of imageInfosAboutToBeRemoved and imageInfosRemoved signals.
void setWatchFlags (const DatabaseFields::Set &set)
 Set a set of database fields to watch.
QList< ItemInfo > uniqueItemInfos () const
void unsetPreprocessor (QObject *const processor)
Public Member Functions inherited from Digikam::DragDropModelImplementation
 DragDropModelImplementation ()=default
 A class providing a sample implementation for a QAbstractItemModel redirecting drag-and-drop support to a handler.
virtual Qt::ItemFlags dragDropFlags (const QModelIndex &index) const
 Call from your flags() method, adding the relevant drag drop flags.
Qt::ItemFlags dragDropFlagsV2 (const QModelIndex &index) const
 This is an alternative approach to dragDropFlags().
AbstractItemDragDropHandler * dragDropHandler () const
bool dropMimeData (const QMimeData *, Qt::DropAction, int, int, const QModelIndex &)
virtual bool isDragEnabled (const QModelIndex &index) const
virtual bool isDropEnabled (const QModelIndex &index) const
QMimeData * mimeData (const QModelIndexList &indexes) const
QStringList mimeTypes () const
void setDragDropHandler (AbstractItemDragDropHandler *handler)
 Set a drag drop handler.
Qt::DropActions supportedDropActions () const
 Implements the relevant QAbstractItemModel methods for drag and drop.

Protected Slots

void incrementalRefresh ()
void scheduleIncrementalRefresh ()
void slotAlbumAdded (Album *album)
void slotAlbumDeleted (Album *album)
void slotAlbumRenamed (Album *album)
void slotAlbumsCleared ()
void slotCollectionImageChange (const CollectionImageChangeset &changeset)
void slotData (const QList< ItemListerRecord > &records)
void slotImageChange (const ImageChangeset &changeset) override
void slotImageTagChange (const ImageTagChangeset &changeset) override
void slotNextIncrementalRefresh ()
void slotResult ()
void slotSearchChange (const SearchChangeset &changeset)
Protected Slots inherited from Digikam::ItemThumbnailModel
void slotThumbnailLoaded (const LoadingDescription &loadingDescription, const QPixmap &thumb)
void slotThumbnailLoadedFromStorage (const LoadingDescription &loadingDescription, const QPixmap &thumb)
Protected Slots inherited from Digikam::ItemModel
virtual void slotAlbumChange (const AlbumChangeset &changeset)
virtual void slotImageChange (const ImageChangeset &changeset)
virtual void slotImageTagChange (const ImageTagChangeset &changeset)

Protected Member Functions

void startListJob (const QList< Album * > &albums)
Protected Member Functions inherited from Digikam::ItemThumbnailModel
void imageInfosCleared () override
 Called when the internal storage is cleared.
Protected Member Functions inherited from Digikam::ItemModel
void emitDataChangedForAll ()
void emitDataChangedForSelection (const QItemSelection &selection)
void finishIncrementalRefresh ()
void finishRefresh ()
bool hasIncrementalRefreshPending () const
virtual void prepareImageInfosAboutToBeRemoved (int, int)
 Called before rowsAboutToBeRemoved.
void requestIncrementalRefresh ()
 As soon as the model is ready to start an incremental refresh, the signal readyForIncrementalRefresh() will be emitted.
void startIncrementalRefresh ()
 Starts an incremental refresh operation.
void startRefresh ()
 Subclasses that add ItemInfos in batches shall call startRefresh() when they start sending batches and finishRefresh() when they have finished.

Additional Inherited Members

Public Types inherited from Digikam::ItemModel
enum  ItemModelRoles {
  ItemModelPointerRole = Qt::UserRole , ItemModelInternalId = Qt::UserRole + 1 , ThumbnailRole = Qt::UserRole + 2 , CreationDateRole = Qt::UserRole + 3 ,
  ExtraDataRole = Qt::UserRole + 5 , ExtraDataDuplicateCount = Qt::UserRole + 6 , LTLeftPanelRole = Qt::UserRole + 50 , LTRightPanelRole = Qt::UserRole + 51 ,
  SubclassRoles = Qt::UserRole + 100 , FilterModelRoles = Qt::UserRole + 500
}
Signals inherited from Digikam::ItemThumbnailModel
void thumbnailAvailable (const QModelIndex &index, int requestedSize)
void thumbnailFailed (const QModelIndex &index, int requestedSize)
Signals inherited from Digikam::ItemModel
void allRefreshingFinished ()
 Signals that the model has finished currently with all scheduled refreshing, full or incremental, and all preprocessing.
void imageChange (const ImageChangeset &, const QItemSelection &)
 If an ImageChangeset affected indexes of this model with changes as set in watchFlags(), this signal contains the changeset and the affected indexes.
void imageInfosAboutToBeAdded (const QList< ItemInfo > &infos)
 Informs that ItemInfos will be added to the model.
void imageInfosAboutToBeRemoved (const QList< ItemInfo > &infos)
 Informs that ItemInfos will be removed from the model.
void imageInfosAdded (const QList< ItemInfo > &infos)
 Informs that ItemInfos have been added to the model.
void imageInfosRemoved (const QList< ItemInfo > &infos)
 Informs that ItemInfos have been removed from the model.
void imageTagChange (const ImageTagChangeset &, const QItemSelection &)
 If an ImageTagChangeset affected indexes of this model, this signal contains the changeset and the affected indexes.
void preprocess (const QList< ItemInfo > &infos, const QList< QVariant > &)
 Connect to this signal only if you are the current preprocessor.
void processAdded (const QList< ItemInfo > &infos, const QList< QVariant > &)
void readyForIncrementalRefresh ()
 Signals that the model is right now ready to start an incremental refresh.
Static Public Member Functions inherited from Digikam::ItemModel
static qlonglong retrieveImageId (const QModelIndex &index)
static ItemInfo retrieveItemInfo (const QModelIndex &index)
 Retrieves the imageInfo object from the data() method of the given index.
Protected Attributes inherited from Digikam::DragDropModelImplementation
AbstractItemDragDropHandler * m_dragDropHandler = nullptr

Member Function Documentation

◆ openAlbum

void Digikam::ItemAlbumModel::openAlbum ( const QList< Album * > & albums)
slot

If called with 0, the model will be empty. Opening the same album again is a no-op.

Extra safety, ensure that no null pointers are added

◆ slotImageChange

void Digikam::ItemAlbumModel::slotImageChange ( const ImageChangeset & changeset)
overrideprotectedslot

QList is designed for multiple selection, for now, only tags are supported for SAlbum it will be a list with one element