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

Signals

void thumbnailAvailable (const QModelIndex &index, int requestedSize)
void thumbnailFailed (const QModelIndex &index, int requestedSize)
Signals inherited from Digikam::ImportItemModel
void allRefreshingFinished ()
 Signals that the model has finished currently with all scheduled refreshing, full or incremental, and all preprocessing.
void itemInfosAboutToBeAdded (const QList< CamItemInfo > &infos)
 Informs that ItemInfos will be added to the model.
void itemInfosAboutToBeRemoved (const QList< CamItemInfo > &infos)
 Informs that CamItemInfos will be removed from the model.
void itemInfosAdded (const QList< CamItemInfo > &infos)
 Informs that ItemInfos have been added to the model.
void itemInfosRemoved (const QList< CamItemInfo > &infos)
 Informs that CamItemInfos have been removed from the model.
void preprocess (const QList< CamItemInfo > &infos)
 Connect to this signal only if you are the current preprocessor.
void processAdded (const QList< CamItemInfo > &infos)
void readyForIncrementalRefresh ()
 Signals that the model is right now ready to start an incremental refresh.

Public Member Functions

 ImportThumbnailModel (QObject *const parent)
 This model provides thumbnail loading, it uses the Camera Controller to retrieve thumbnails for CamItemInfos.
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Handles the ThumbnailRole.
void setCameraThumbsController (CameraThumbsCtrl *const thumbsCtrl) override
 Sets the camera thumbs controller which is used to get the thumbnails for item infos.
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.
ThumbnailSize thumbnailSize () const
 Get the thumbnail size.
Public Member Functions inherited from Digikam::ImportItemModel
 ImportItemModel (QObject *const parent=nullptr)
void addCamItemInfosSynchronously (const Digikam::CamItemInfoList &infos)
void addCamItemInfoSynchronously (const CamItemInfo &info)
 addCamItemInfo() is asynchronous if a prepocessor is set.
qlonglong camItemId (const QModelIndex &index) const
qlonglong camItemId (int row) const
QList< qlonglong > camItemIds () const
QList< qlonglong > camItemIds (const QList< QModelIndex > &indexes) const
CamItemInfo camItemInfo (const QModelIndex &index) const
CamItemInfo camItemInfo (const QUrl &fileUrl) const
CamItemInfo camItemInfo (int row) const
CamItemInfo & camItemInfoRef (const QModelIndex &index) const
CamItemInfo & camItemInfoRef (int row) const
QList< CamItemInfo > camItemInfos () const
CamItemInfoList camItemInfos (const QList< QModelIndex > &indexes) const
QList< CamItemInfo > camItemInfos (const QUrl &fileUrl) const
void clearCamItemInfos ()
 Clears the CamItemInfos and resets the model.
QVariant data (const QModelIndex &index, int role) const override
Qt::ItemFlags flags (const QModelIndex &index) const override
bool hasImage (const CamItemInfo &info) const
bool hasImage (qlonglong id) const
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
QModelIndex index (int row, int column, const QModelIndex &parent) const override
QList< QModelIndex > indexesForCamItemId (qlonglong id) const
QList< QModelIndex > indexesForCamItemInfo (const CamItemInfo &info) const
QList< QModelIndex > indexesForUrl (const QUrl &fileUrl) const
QModelIndex indexForCamItemId (qlonglong id) const
QModelIndex indexForCamItemInfo (const CamItemInfo &info) const
QModelIndex indexForUrl (const QUrl &fileUrl) const
bool isEmpty () const
bool isRefreshing () const
bool keepsFileUrlCache () const
int numberOfIndexesForCamItemId (qlonglong id) const
int numberOfIndexesForCamItemInfo (const CamItemInfo &info) const
void removeCamItemInfo (const CamItemInfo &info)
void removeCamItemInfos (const QList< CamItemInfo > &infos)
void removeIndex (const QModelIndex &index)
 Remove the given infos or indexes directly from the model.
void removeIndexs (const QList< QModelIndex > &indexes)
int rowCount (const QModelIndex &parent) const override
 QAbstractListModel implementation.
void setCamItemInfos (const CamItemInfoList &infos)
 Clears and adds infos.
void setKeepsFileUrlCache (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 setSendRemovalSignals (bool send)
 DragDrop methods.
QList< CamItemInfo > uniqueCamItemInfos () const
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.

Additional Inherited Members

Public Types inherited from Digikam::ImportItemModel
enum  ImportItemModelRoles {
  ImportItemModelPointerRole = Qt::UserRole , ImportItemModelInternalId = Qt::UserRole + 1 , ThumbnailRole = Qt::UserRole + 2 , ExtraDataRole = Qt::UserRole + 3 ,
  ExtraDataDuplicateCount = Qt::UserRole + 6 , FilterModelRoles = Qt::UserRole + 100
}
Public Slots inherited from Digikam::ImportItemModel
void addCamItemInfo (const CamItemInfo &info)
void addCamItemInfos (const CamItemInfoList &infos)
void reAddCamItemInfos (const CamItemInfoList &infos)
void reAddingFinished ()
void slotFileDeleted (const QString &folder, const QString &file, bool status)
void slotFileUploaded (const CamItemInfo &info)
Static Public Member Functions inherited from Digikam::ImportItemModel
static qlonglong retrieveCamItemId (const QModelIndex &index)
static CamItemInfo retrieveCamItemInfo (const QModelIndex &index)
 Retrieve the CamItemInfo object from the data() function of the given index The index may be from a QSortFilterProxyModel as long as an ImportItemModel is at the end.
Protected Member Functions inherited from Digikam::ImportItemModel
virtual void camItemInfosCleared ()
 Called when the internal storage is cleared.
void emitDataChangedForAll ()
void emitDataChangedForSelections (const QItemSelection &selection)
void finishIncrementalRefresh ()
void finishRefresh ()
bool hasIncrementalRefreshPending () const
virtual void prepareItemInfosAboutToBeRemoved (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 CamItemInfos in batches shall call startRefresh() when they start sending batches and finishRefresh() when they have finished.
Protected Attributes inherited from Digikam::DragDropModelImplementation
AbstractItemDragDropHandler * m_dragDropHandler = nullptr

Constructor & Destructor Documentation

◆ ImportThumbnailModel()

Digikam::ImportThumbnailModel::ImportThumbnailModel ( QObject *const parent)
explicit

It also provides preloading of thumbnails, and caching facility. Thumbnails size can be adjusted.

Member Function Documentation

◆ data()

QVariant Digikam::ImportThumbnailModel::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.

◆ setCameraThumbsController()

void Digikam::ImportThumbnailModel::setCameraThumbsController ( CameraThumbsCtrl *const thumbsCtrl)
overridevirtual

Reimplemented from Digikam::ImportItemModel.

◆ setData()

bool Digikam::ImportThumbnailModel::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::ImportThumbnailModel::setEmitDataChanged ( bool emitSignal)

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