Hi,

It seems part of this question has already been asked a few time, but I haven't been able to find any matching answer until now, so I decided to create a new post.

I have a tree containing my scene graph, using a custom derived QtTreeWidget class directly (no model/view):

qt.png

Now, I have two issues, which are linked together I guess, related to moving items within the tree:


  1. first of all, no drop indicator is being shown, although I think I have called the right code:
    Qt Code:
    1. setAcceptDrops(imTRUE);
    2. setDragEnabled(true);
    3. setDragDropMode(DragDrop);
    4. setDragDropOverwriteMode(imFALSE);
    5. setDropIndicatorShown(imTRUE);
    6.  
    7. setSelectionMode(QAbstractItemView::SingleSelection);
    8. setSelectionBehavior(QAbstractItemView::SelectRows);
    To copy to clipboard, switch view to plain text mode 
    I have tried to derive my own style and experiment with QStyle::PE_IndicatorItemViewItemDrop, but without any success.
    I have also tried to draw a custom line by myself, but I can't figure out where it should be drawn exactly (see point 2 below).

  2. it is very hard to precisely define where the node will be dropped. More precisely, I can't figure out why the node gets sometimes added as child of the target, and sometimes it gets added before or after the target item. I know the position of the cursor defines this behaviour, however, without any visual indicator, this is really hard to use.


Any help would be appreciated, I have had this issue for month now
Thanks guys !