-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Done
-
Affects Version/s: 5.0.1, 5.3.1
-
Fix Version/s: 5.4.1
-
Component/s: GUI: Drag and Drop, Widgets: Itemviews
-
Labels:None
-
Commits:b13aa15e1007a1b5ed61049bbd9ef8f95b6d12a5
A virtual function canDropMimeData() never get called, because there is no code that calls it.
Full search over Qt sources gives only three entries for 'canDropMimeData'.
Two of them are function definition and declaration in qabstractitemview.h/.cpp files.
The third is a part of a comment.
Some more code:
1. Drag enter event handler. Qt decides to allow or to forbid a drop operation via canDecode() function result.
void QAbstractItemView::dragEnterEvent(QDragEnterEvent *event) { if (dragDropMode() == InternalMove && (event->source() != this|| !(event->possibleActions() & Qt::MoveAction))) return; if (d_func()->canDecode(event)) { event->accept(); setState(DraggingState); } else { event->ignore(); } }
2. canDecode() source code. No canDropMimeData() call here.
inline bool canDecode(QDropEvent *e) const { QStringList modelTypes = model->mimeTypes(); const QMimeData *mime = e->mimeData(); for (int i = 0; i < modelTypes.count(); ++i) if (mime->hasFormat(modelTypes.at(i)) && (e->dropAction() & model->supportedDropActions())) return true; return false; }
As a result, there is no way to customize drop/non-drop logic on per-node basis.
For Gerrit Dashboard: QTBUG-30534 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
100197,6 | QAbstractItemView: call canDropMimeData, as one would expect. | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |