digiKam
|
Public Member Functions | |
virtual Qt::ItemFlags | dragDropFlags (const QModelIndex &index) const |
Qt::ItemFlags | dragDropFlagsV2 (const QModelIndex &index) const |
AbstractItemDragDropHandler * | dragDropHandler () 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 | |
AbstractItemDragDropHandler * | m_dragDropHandler |
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.
|
virtual |
|
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().
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().
AbstractItemDragDropHandler * Digikam::DragDropModelImplementation::dragDropHandler | ( | ) | const |
References m_dragDropHandler.
Referenced by Digikam::TableViewTreeView::dragDropHandler(), Digikam::TableViewModel::mimeData(), and Digikam::TableViewModel::mimeTypes().
bool Digikam::DragDropModelImplementation::dropMimeData | ( | const QMimeData * | , |
Qt::DropAction | , | ||
int | , | ||
int | , | ||
const QModelIndex & | |||
) |
|
virtual |
Referenced by dragDropFlagsV2().
|
virtual |
Referenced by dragDropFlagsV2().
QMimeData * Digikam::DragDropModelImplementation::mimeData | ( | const QModelIndexList & | indexes | ) | const |
References Digikam::AbstractItemDragDropHandler::createMimeData(), and m_dragDropHandler.
QStringList Digikam::DragDropModelImplementation::mimeTypes | ( | ) | const |
References m_dragDropHandler, and Digikam::AbstractItemDragDropHandler::mimeTypes().
void Digikam::DragDropModelImplementation::setDragDropHandler | ( | AbstractItemDragDropHandler * | handler | ) |
Set a drag drop handler.
References m_dragDropHandler.
Referenced by Digikam::DigikamItemView::DigikamItemView(), and Digikam::ImportIconView::ImportIconView().
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.
|
protected |
Referenced by dragDropFlags(), dragDropHandler(), mimeData(), mimeTypes(), and setDragDropHandler().