From b13aa15e1007a1b5ed61049bbd9ef8f95b6d12a5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 21 Nov 2014 10:46:22 +0100 Subject: QAbstractItemView: call canDropMimeData, as one would expect. The virtual method was added for 5.0 but never called. The old code (only checking mimetypes) is now the default implementation for canDropMimeData. Model subclasses can now refine this by having index-specific logic instead, or in order to inspect the dropped data (e.g. to accept files and refuse directories, which are all text/uri-list). [ChangeLog][QtWidgets][QAbstractItemView] now calls canDropMimeData in order to decide whether or not to accept the drop. Task-number: QTBUG-30534 Change-Id: Ied3aa964b4025bae6a1a26df89a681bfe61c3faa Reviewed-by: Stephen Kelly --- src/widgets/doc/src/model-view-programming.qdoc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/doc/src/model-view-programming.qdoc') diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc index 8978efa1e3..ada0460689 100644 --- a/src/widgets/doc/src/model-view-programming.qdoc +++ b/src/widgets/doc/src/model-view-programming.qdoc @@ -1769,6 +1769,9 @@ dropped onto existing items separately to data dropped into the top level of the model (i.e., onto an invalid item). + Models can forbid dropping on certain items, or depending on the dropped data, + by reimplementing QAbstractItemModel::canDropMimeData(). + The model first has to make sure that the operation should be acted on, the data supplied is in a format that can be used, and that its destination within the model is valid: -- cgit v1.2.3