summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-08 13:22:49 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-08 13:26:44 +0200
commit1fce111809f216383e60f56b57a9f68ccd2b766f (patch)
tree521d560ae28354ec495ee49e2abf4cfd28303c3f /src/widgets/itemviews/qabstractitemview_p.h
parente6ffb36b5517d1d4025718b56423db9bdf0a63f8 (diff)
parent3545ef41217e3ce4d1bea2b07793fa7a8c1058a6 (diff)
Merge remote-tracking branch 'origin/5.4' into merge5.5
Conflicts: src/corelib/global/qglobal.h src/corelib/io/qnoncontiguousbytedevice_p.h src/gui/image/qjpeghandler.cpp src/network/access/qhttpthreaddelegate_p.h tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp tests/auto/widgets/widgets/qmenubar/BLACKLIST Change-Id: I01de8c1c28efcedfd7953d05025f54802dc08ab3
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview_p.h')
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index b792228312..016c50436b 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -168,8 +168,20 @@ public:
QModelIndex index;
int col = -1;
int row = -1;
+ const QMimeData *mime = event->mimeData();
+
+ // Drag enter event shall always be accepted, if mime type and action match.
+ // Whether the data can actually be dropped will be checked in drag move.
+ if (event->type() == QEvent::DragEnter) {
+ const QStringList modelTypes = model->mimeTypes();
+ for (int i = 0; i < modelTypes.count(); ++i)
+ if (mime->hasFormat(modelTypes.at(i))
+ && (event->dropAction() & model->supportedDropActions()))
+ return true;
+ }
+
if (dropOn(event, &row, &col, &index)) {
- return model->canDropMimeData(event->mimeData(),
+ return model->canDropMimeData(mime,
dragDropMode == QAbstractItemView::InternalMove ? Qt::MoveAction : event->dropAction(),
row, col, index);
}