digiKam
Digikam::DragDropModelImplementation Class Reference
+ Inheritance diagram for Digikam::DragDropModelImplementation:

Public Member Functions

virtual Qt::ItemFlags dragDropFlags (const QModelIndex &index) const
 
Qt::ItemFlags dragDropFlagsV2 (const QModelIndex &index) const
 
AbstractItemDragDropHandlerdragDropHandler () const
 
 DragDropModelImplementation ()
 
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)
 
Qt::DropActions supportedDropActions () const
 
virtual ~DragDropModelImplementation ()
 

Protected Attributes

AbstractItemDragDropHandlerm_dragDropHandler
 

Constructor & Destructor Documentation

◆ DragDropModelImplementation()

Digikam::DragDropModelImplementation::DragDropModelImplementation ( )

A class providing a sample implementation for a QAbstractItemModel redirecting drag-and-drop support to a handler. Include the macro DECLARE_Model_DRAG_DROP_METHODS in your derived QAbstractItemModel class.

◆ ~DragDropModelImplementation()

Digikam::DragDropModelImplementation::~DragDropModelImplementation ( )
virtual

Member Function Documentation

◆ dragDropFlags()

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

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 m_dragDropHandler.

Referenced by Digikam::ItemModel::flags(), ShowFoto::ShowfotoItemModel::flags(), and Digikam::ImportItemModel::flags().

◆ dragDropFlagsV2()

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

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 isDragEnabled(), and isDropEnabled().

◆ dragDropHandler()

◆ dropMimeData()

bool Digikam::DragDropModelImplementation::dropMimeData ( const QMimeData *  ,
Qt::DropAction  ,
int  ,
int  ,
const QModelIndex &   
)

◆ isDragEnabled()

bool Digikam::DragDropModelImplementation::isDragEnabled ( const QModelIndex &  index) const
virtual

Referenced by dragDropFlagsV2().

◆ isDropEnabled()

bool Digikam::DragDropModelImplementation::isDropEnabled ( const QModelIndex &  index) const
virtual

Referenced by dragDropFlagsV2().

◆ mimeData()

QMimeData * Digikam::DragDropModelImplementation::mimeData ( const QModelIndexList &  indexes) const

◆ mimeTypes()

QStringList Digikam::DragDropModelImplementation::mimeTypes ( ) const

◆ setDragDropHandler()

void Digikam::DragDropModelImplementation::setDragDropHandler ( AbstractItemDragDropHandler handler)

◆ supportedDropActions()

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

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.

Member Data Documentation

◆ m_dragDropHandler

AbstractItemDragDropHandler* Digikam::DragDropModelImplementation::m_dragDropHandler
protected

The documentation for this class was generated from the following files: