digiKam Developer Documentation: Digikam::DragDropModelImplementation Class Reference

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

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

## Public Member Functions
| 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 Attributes
AbstractItemDragDropHandler * | m_dragDropHandler = nullptr

## Constructor & Destructor Documentation

## ◆ DragDropModelImplementation()

Digikam::DragDropModelImplementation::DragDropModelImplementation | ( |  | ) |
| default

Include the macro DECLARE_Model_DRAG_DROP_METHODS in your derived QAbstractItemModel class.

## Member Function Documentation

## ◆ dragDropFlags()

Qt::ItemFlags Digikam::DragDropModelImplementation::dragDropFlags | ( | const QModelIndex & | index | ) | const
| virtual

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.

## ◆ dragDropFlagsV2()

Qt::ItemFlags Digikam::DragDropModelImplementation::dragDropFlagsV2 | ( | const QModelIndex & | index | ) | const

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.

## ◆ supportedDropActions()

Qt::DropActions Digikam::DragDropModelImplementation::supportedDropActions | ( |  | ) | const

All functionality is redirected to the handler. dropMimeData() always returns false, leaving implementation to the view.