summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:05:26 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:05:40 +0200
commit98cf120f5e1803867ab8065778d8dec3f26ad2e4 (patch)
tree80e6ca98ab4415d88209a4f82890535e20a9805a /src/widgets
parent4db5d3ccd17d448b59db491e2f261892f31fec74 (diff)
parent1f281bfd63402b50f3db378a027da26ca52ffb27 (diff)
Merge remote-tracking branch 'origin/5.4.2' into 5.4
Diffstat (limited to 'src/widgets')
-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 c3bd1fb504..be5d4b7b71 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);
}