digiKam
|
Public Types | |
enum | ExtraRoles { IsImageItemRole = Qt::UserRole + 1000 , IsFilterActionItemRole = Qt::UserRole + 1001 , IsHeaderItemRole = Qt::UserRole + 1002 , IsCategoryItemRole = Qt::UserRole + 1003 , IsSeparatorItemRole = Qt::UserRole + 1004 , IsSubjectImageRole = Qt::UserRole + 1010 , FilterActionRole = Qt::UserRole + 1020 } |
enum | Mode { ImagesListMode , ImagesTreeMode , CombinedTreeMode } |
Public Member Functions | |
virtual Qt::ItemFlags | dragDropFlags (const QModelIndex &index) const |
Qt::ItemFlags | dragDropFlagsV2 (const QModelIndex &index) const |
AbstractItemDragDropHandler * | dragDropHandler () const |
bool | dropMimeData (const QMimeData *, Qt::DropAction, int, int, const QModelIndex &) |
FilterAction | filterAction (const QModelIndex &index) const |
bool | hasImage (const ItemInfo &info) |
ItemInfo | imageInfo (const QModelIndex &index) const |
DECLARE_MODEL_DRAG_DROP_METHODS ItemListModel * | imageModel () const |
QModelIndex | imageModelIndex (const QModelIndex &index) const |
QModelIndex | indexForInfo (const ItemInfo &info) const |
Note: There may be multiple indexes for an info. The index found first is returned. More... | |
virtual bool | isDragEnabled (const QModelIndex &index) const |
virtual bool | isDropEnabled (const QModelIndex &index) const |
bool | isFilterAction (const QModelIndex &index) const |
bool | isImage (const QModelIndex &index) const |
ItemHistoryGraphModel (QObject *const parent=nullptr) | |
QMimeData * | mimeData (const QModelIndexList &indexes) const |
QStringList | mimeTypes () const |
Mode | mode () const |
void | setDragDropHandler (AbstractItemDragDropHandler *handler) |
void | setHistory (const ItemInfo &subject, const ItemHistoryGraph &graph=ItemHistoryGraph()) |
void | setMode (Mode mode) |
ItemInfo | subject () const |
Qt::DropActions | supportedDropActions () const |
~ItemHistoryGraphModel () override | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QAbstractItemModel implementation. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | parent (const QModelIndex &index) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
Protected Attributes | |
AbstractItemDragDropHandler * | m_dragDropHandler |
|
explicit |
|
override |
|
override |
|
override |
References Digikam::DCategorizedSortFilterProxyModel::CategoryDisplayRole, FilterActionRole, Digikam::DImgFilterManager::filterIcon(), Digikam::DImgFilterManager::i18nDisplayableName(), if_isItem, index(), Digikam::DImgFilterManager::instance(), IsCategoryItemRole, IsFilterActionItemRole, IsHeaderItemRole, IsImageItemRole, IsSeparatorItemRole, IsSubjectImageRole, Digikam::HistoryImageId::Original, and Digikam::HistoryImageId::Source.
|
virtualinherited |
Call from your flags() method, adding the relevant drag drop flags. Default implementation enables both drag and drop on the index if a drag drop handler is set. Reimplement to fine-tune. Note: There is an alternative below.
References Digikam::DragDropModelImplementation::m_dragDropHandler.
Referenced by Digikam::ItemModel::flags(), ShowFoto::ShowfotoItemModel::flags(), and Digikam::ImportItemModel::flags().
|
inherited |
This is an alternative approach to dragDropFlags(). dragDropFlagsV2 calls the virtual methods isDragEnabled() and isDropEnabled() which you then reimplement. Use simple dragDropFlags() if you need not customization, or reimplement dragDropFlags() if you fine-tune it yourself.
References Digikam::DragDropModelImplementation::isDragEnabled(), and Digikam::DragDropModelImplementation::isDropEnabled().
|
inherited |
|
inherited |
FilterAction Digikam::ItemHistoryGraphModel::filterAction | ( | const QModelIndex & | index | ) | const |
|
override |
|
override |
References parent().
bool Digikam::ItemHistoryGraphModel::hasImage | ( | const ItemInfo & | info | ) |
|
override |
QAbstractItemModel implementation.
ItemInfo Digikam::ItemHistoryGraphModel::imageInfo | ( | const QModelIndex & | index | ) | const |
References imageModelIndex(), index(), and Digikam::ItemModel::retrieveItemInfo().
ItemListModel * Digikam::ItemHistoryGraphModel::imageModel | ( | ) | const |
Returns an internal image model used for entries representing images. Note: Set a thumbnail thread on this model if you need thumbnails.
QModelIndex Digikam::ItemHistoryGraphModel::imageModelIndex | ( | const QModelIndex & | index | ) | const |
If the given index is represented by the internal image model, return the image model's index. Otherwise an invalid index is returned.
References if_isItem, and index().
Referenced by imageInfo().
|
override |
References parent().
Referenced by data(), filterAction(), flags(), imageInfo(), imageModelIndex(), isFilterAction(), isImage(), parent(), and setData().
QModelIndex Digikam::ItemHistoryGraphModel::indexForInfo | ( | const ItemInfo & | info | ) | const |
Note: There may be multiple indexes for an info. The index found first is returned.
References Digikam::ItemInfo::isNull(), and Digikam::ItemModel::retrieveItemInfo().
|
virtualinherited |
Referenced by Digikam::DragDropModelImplementation::dragDropFlagsV2().
|
virtualinherited |
Referenced by Digikam::DragDropModelImplementation::dragDropFlagsV2().
bool Digikam::ItemHistoryGraphModel::isFilterAction | ( | const QModelIndex & | index | ) | const |
References index().
bool Digikam::ItemHistoryGraphModel::isImage | ( | const QModelIndex & | index | ) | const |
References index().
|
inherited |
|
inherited |
ItemHistoryGraphModel::Mode Digikam::ItemHistoryGraphModel::mode | ( | ) | const |
Referenced by setMode().
|
override |
References index().
Referenced by hasChildren(), index(), and rowCount().
|
override |
References parent().
|
override |
|
inherited |
Set a drag drop handler.
References Digikam::DragDropModelImplementation::m_dragDropHandler.
Referenced by Digikam::DigikamItemView::DigikamItemView(), and Digikam::ImportIconView::ImportIconView().
void Digikam::ItemHistoryGraphModel::setHistory | ( | const ItemInfo & | subject, |
const ItemHistoryGraph & | graph = ItemHistoryGraph() |
||
) |
Set the history subject and the history graph. Per default, the subject's history graph is read.
References Digikam::ItemHistoryGraph::fromInfo(), Digikam::ItemHistoryGraph::isNull(), and subject().
Referenced by setMode().
void Digikam::ItemHistoryGraphModel::setMode | ( | Mode | mode | ) |
References mode(), and setHistory().
ItemInfo Digikam::ItemHistoryGraphModel::subject | ( | ) | const |
Referenced by setHistory().
|
inherited |
Implements the relevant QAbstractItemModel methods for drag and drop. All functionality is redirected to the handler. dropMimeData() always returns false, leaving implementation to the view.
References Digikam::CopyAction, and Digikam::MoveAction.
|
protectedinherited |