Solved Question about QAbstractItemModel::canDropMimeData()
-
In my custom model's implementation of
dropMimeData()
:Do I need to call
canDropMimeData()
myself before proceeding with the actual implementation, or can I assume that the underlying framework has already called this before it callsdropMimeData()
?My custom model has its own implementation of
canDropMimeData()
. -
canDropMimeData() is there to see if a drop can occour - if it returns false dropMimeData() will not be called (otherwise canDropMimeData() would be useless).
-
@christian-ehrlicher : Thanks for the clear explanation. It is logical that the framework would call this function at some point. But I could not find any place in the Qt source code where
QTableView
or one of the other item view classes actually calls this. Can anyone please point it out? -
It's the base class which is calling the function. See https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qabstractitemview_p.h.html#_ZN24QAbstractItemViewPrivate7canDropEP10QDropEvent
-
@christian-ehrlicher : Excellent ... thank you!
-
@christian-ehrlicher : And thanks for the link to the fantastic woboq.org site which was new to me. All the sources are hyperlinked, so it is very easy to navigate!