Important: Please read the Qt Code of Conduct -

QtTreeWidget: issue with indicator display + drop target

  • 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):


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

    • first of all, no drop indicator is being shown, although I think I have called the right code:


    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).

    • 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 !

Log in to reply