[Qt-interest] prevent a drop in QTreeWidget
Bo Thorsen
bo at fioniasoftware.dk
Fri May 27 15:01:37 CEST 2011
Den 27-05-2011 10:03, Graham Labdon skrev:
> Hi
> Can someone advise me how to prevent a drop being accepted in certain circumstances in a QTreeWidget?
> I have derived a class from QTreeWidget and have reimplemented the DropEvent method.
> How do I get the information that tells me where the item is being dropped so I can tell whether or not the drop should be allowed?
I saw that you already got something working. But it's actually the
wrong direction you are going in.
Don't touch the drop code on QTreeWidget. Instead, handle this in the
model. You should read the entire section on using drag and drop with
the model/view classes.
The method you need here is QAbstractItemModel::dropMimeData(...).
Override that instead of the view.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-interest-old
mailing list