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

Public Slots

void slotThumbInfoLoaded (const ShowfotoItemInfo &info, const QImage &thumbnailImage)
 
- Public Slots inherited from ShowFoto::ShowfotoItemModel
void reAddingFinished ()
 
void reAddShowfotoItemInfos (const ShowfotoItemInfoList &infos)
 
void slotFileDeleted (const QString &folder, const QString &file, bool status)
 
void slotFileUploaded (const ShowfotoItemInfo &info)
 

Signals

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

Public Member Functions

 ShowfotoThumbnailModel (QWidget *const parent)
 An ItemModel that supports thumbnail loading.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Handles the ThumbnailRole.
 
bool getThumbnail (const ShowfotoItemInfo &itemInfo, QImage &thumbnail) const
 
bool pixmapForItem (const QString &url, QPixmap &pix) const
 
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 *thread)
 Enable thumbnail loading and set the thread that shall be used.
 
void setThumbnailSize (const ThumbnailSize &thumbSize)
 Set the thumbnail size to use.
 
ThumbnailLoadThreadthumbnailLoadThread () const
 
ThumbnailSize thumbnailSize () const
 
- Public Member Functions inherited from ShowFoto::ShowfotoItemModel
 ShowfotoItemModel (QObject *const parent)
 
void addShowfotoItemInfo (const ShowfotoItemInfo &info)
 
void addShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 
void addShowfotoItemInfosSynchronously (const QList< ShowfotoItemInfo > &infos)
 
void addShowfotoItemInfoSynchronously (const ShowfotoItemInfo &info)
 addShowfotoItemInfo() is asynchronous if a prepocessor is set.
 
void clearShowfotoItemInfos ()
 Clears the ShowfotoItemInfos and resets the model.
 
QVariant data (const QModelIndex &index, int role) const override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool hasImage (const ShowfotoItemInfo &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 > indexesForShowfotoItemId (qlonglong id) const
 
QList< QModelIndex > indexesForShowfotoItemInfo (const ShowfotoItemInfo &info) const
 
QList< QModelIndex > indexesForUrl (const QUrl &fileUrl) const
 
QModelIndex indexForShowfotoItemId (qlonglong id) const
 
QModelIndex indexForShowfotoItemInfo (const ShowfotoItemInfo &info) const
 Return the index of a given ShowfotoItemInfo, if it exists in the model.
 
QModelIndex indexForUrl (const QUrl &fileUrl) const
 Returns the index or ShowfotoItemInfo object from the underlying data for the given file url.
 
bool isEmpty () const
 
int numberOfIndexesForShowfotoItemId (qlonglong id) const
 
int numberOfIndexesForShowfotoItemInfo (const ShowfotoItemInfo &info) const
 
void removeIndex (const QModelIndex &index)
 Remove the given infos or indexes directly from the model.
 
void removeIndexs (const QList< QModelIndex > &indexes)
 
void removeShowfotoItemInfo (const ShowfotoItemInfo &info)
 
void removeShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 
int rowCount (const QModelIndex &parent) const override
 QAbstractListModel implementations.
 
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.
 
void setShowfotoItemInfos (const QList< ShowfotoItemInfo > &infos)
 Clears and adds infos.
 
qlonglong showfotoItemId (const QModelIndex &index) const
 
qlonglong showfotoItemId (int row) const
 
QList< qlonglong > showfotoItemIds () const
 
QList< qlonglong > showfotoItemIds (const QList< QModelIndex > &indexes) const
 
ShowfotoItemInfo showfotoItemInfo (const QModelIndex &index) const
 Returns the ShowfotoItemInfo object, reference from the underlying data pointed to by the index.
 
ShowfotoItemInfo showfotoItemInfo (const QUrl &fileUrl) const
 
ShowfotoItemInfo showfotoItemInfo (int row) const
 Returns the ShowfotoItemInfo object, reference from the underlying data of the given row (parent is the invalid QModelIndex, column is 0).
 
ShowfotoItemInfoshowfotoItemInfoRef (const QModelIndex &index) const
 
ShowfotoItemInfoshowfotoItemInfoRef (int row) const
 
QList< ShowfotoItemInfoshowfotoItemInfos () const
 
ShowfotoItemInfoList showfotoItemInfos (const QList< QModelIndex > &indexes) const
 
QList< ShowfotoItemInfoshowfotoItemInfos (const QUrl &fileUrl) const
 
QList< ShowfotoItemInfouniqueShowfotoItemInfos () 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().
 
AbstractItemDragDropHandlerdragDropHandler () 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)
 

Protected Member Functions

void showfotoItemInfosCleared () override
 Called when the internal storage is cleared.
 
- Protected Member Functions inherited from ShowFoto::ShowfotoItemModel
void emitDataChangedForAll ()
 
void emitDataChangedForSelections (const QItemSelection &selection)
 
void finishIncrementalRefresh ()
 
void requestIncrementalRefresh ()
 As soon as the model is ready to start an incremental refresh, the signal readyForIncrementalRefresh() will be emitted.
 
virtual void showfotoItemInfosAboutToBeRemoved (int, int)
 Called before rowsAboutToBeRemoved.
 
void startIncrementalRefresh ()
 Starts an incremental refresh operation.
 

Additional Inherited Members

- Public Types inherited from ShowFoto::ShowfotoItemModel
enum  ShowfotoItemModelRoles {
  ShowfotoItemModelPointerRole = Qt::UserRole , ShowfotoItemModelInternalId = Qt::UserRole + 1 , ThumbnailRole = Qt::UserRole + 2 , ExtraDataRole = Qt::UserRole + 3 ,
  ExtraDataDuplicateCount = Qt::UserRole + 6 , FilterModelRoles = Qt::UserRole + 100
}
 
- Static Public Member Functions inherited from ShowFoto::ShowfotoItemModel
static qlonglong retrieveShowfotoItemId (const QModelIndex &index)
 
static ShowfotoItemInfo retrieveShowfotoItemInfo (const QModelIndex &index)
 Retrieve the ShowfotoItemInfo object from the data() function of the given index The index may be from a QSortFilterProxyModel as long as an ShowfotoItemModel is at the end.
 
- Protected Attributes inherited from Digikam::DragDropModelImplementation
AbstractItemDragDropHandlerm_dragDropHandler = nullptr
 

Constructor & Destructor Documentation

◆ ShowfotoThumbnailModel()

ShowFoto::ShowfotoThumbnailModel::ShowfotoThumbnailModel ( QWidget *const  parent)
explicit

You need to set a ThumbnailLoadThread to enable thumbnail loading. Adjust the thumbnail size to your needs. Note that setKeepsFilePatindexesForPathhCache is enabled per default.

Member Function Documentation

◆ data()

QVariant ShowFoto::ShowfotoThumbnailModel::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.

◆ setData()

bool ShowFoto::ShowfotoThumbnailModel::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 ShowFoto::ShowfotoThumbnailModel::setEmitDataChanged ( bool  emitSignal)

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

◆ setPreloadThumbnails()

void ShowFoto::ShowfotoThumbnailModel::setPreloadThumbnails ( bool  preload)

Default: false.

◆ setThumbnailLoadThread()

void ShowFoto::ShowfotoThumbnailModel::setThumbnailLoadThread ( ThumbnailLoadThread thread)

The thumbnail size of this thread will be adjusted.

◆ showfotoItemInfosCleared()

void ShowFoto::ShowfotoThumbnailModel::showfotoItemInfosCleared ( )
overrideprotectedvirtual

Reimplemented from ShowFoto::ShowfotoItemModel.