PDA

View Full Version : dragMoveEvent never "on" an item



shevitz
10th December 2010, 19:37
I am writing an app with a custom model and QTreeView. I am trying to disallow
drops on items with two children. (In other words I am trying to create a binary tree).
I have overridden dragMoveEvent to do this. The problem is that if I put in a test
to for inserting between items as well, the dropIndicatorPosition is always above or
below an item. Never on it.This is messing me up royally since I can only drag onto
the root node, and never onto the children.

I realize this is a tall order without posting source code, but can anyone suggest a
reason why the framework might, for dropIndicatorPosition, have "hysteresis" and
return "on" on the root node, but only "above" and "below" for children.

FWIW, in my dragMoveEvent code I am using to prevent the drop:

event->setDropAction(Qt::IgnoreAction)
event->accept()
return

thanks,
Danny

wysota
12th December 2010, 10:23
How did you implement flags() for your model? Do you allow drop on items there?