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

Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
Digikam::ItemThumbnailModel Class Reference
Inheritance diagram for Digikam::ItemThumbnailModel:

## Public Slots
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)

## Signals
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.

## Public Member Functions
| 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 | 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 | 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 }
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

## Constructor & Destructor Documentation

## ◆ ItemThumbnailModel()

Digikam::ItemThumbnailModel::ItemThumbnailModel | ( | QWidget *const | parent | ) |
| explicit

You need to set a ThumbnailLoadThread to enable thumbnail loading. Adjust the thumbnail size to your needs.

Note
  setKeepsFilePathCache is enabled per default.

## Member Function Documentation

## ◆ data()

QVariant Digikam::ItemThumbnailModel::data | ( | const QModelIndex & | index,
|  | int | role = `Qt::DisplayRole`
| ) |  | const
| override

If the pixmap is available, returns it in the QVariant. If it still needs to be loaded, returns a null QVariant and emits thumbnailAvailable() as soon as it is available.

## ◆ imageInfosCleared()

void Digikam::ItemThumbnailModel::imageInfosCleared | ( |  | ) |
| override protected virtual

Reimplemented from Digikam::ItemModel.

Reimplemented in Digikam::LightTableItemListModel.

## ◆ preloadThumbnails

void Digikam::ItemThumbnailModel::preloadThumbnails | ( | const QList< ItemInfo > & | infos | ) |
| slot

indexes.

Note
  Use setPreloadThumbnails to automatically preload all entries in the model. This only ensures thumbnail generation. It is not guaranteed that pixmaps are stored in the cache. For thumbnails that are expect to be drawn immediately, include them in prepareThumbnails(). Stops preloading of previously added thumbnails.

## ◆ setData()

bool Digikam::ItemThumbnailModel::setData | ( | const QModelIndex & | index,
|  | const QVariant & | value,
|  | int | role = `Qt::DisplayRole`
| ) |  |
| override

Set a null QVariant to use the thumbnail size set by setThumbnailSize() again. The index given here is ignored for this purpose.

## ◆ setEmitDataChanged()

void Digikam::ItemThumbnailModel::setEmitDataChanged | ( | bool | emitSignal | ) |

The thumbnailAvailable() signal will be emitted in any case. Default is true.

## ◆ setPreloadThumbnails()

void Digikam::ItemThumbnailModel::setPreloadThumbnails | ( | bool | preload | ) |

Default is false.

## ◆ setThumbnailLoadThread()

void Digikam::ItemThumbnailModel::setThumbnailLoadThread | ( | ThumbnailLoadThread *const | thread | ) |

The thumbnail size of this thread will be adjusted.