Results 1 to 1 of 1

Thread: QTreeView Drag&Drop Indicator above&below only shown when items have children

  1. #1
    Join Date
    Apr 2019
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Question QTreeView Drag&Drop Indicator above&below only shown when items have children

    Hi,

    I have a QTreeView where I want to enable the user to sort the items by drag&drop. Dropping an item onto another (QAbstractItemView::DropIndicatorPosition::OnItem) should add the item as a child, and dropping when DropIndicatorPosition::AboveItem or DropIndicatorPosition::BelowItem is shown should insert the item before/after the target on the same level.

    The problem is that the AboveItem/BelowItem Indicators are only shown when the items have children, making it possible to insert the item into another but leaving it impossible to change the order when the neighboritems dont have children.

    I have tried setting DragDropMode to InternalMove (since there is no Drag&Drop between TreeViews) but that makes it buggy (DragMoveEvent is overwritten and checks every item individually if a drop is possible) and does'nt help. Is it possible to activate above/below indicators permanently for all items?

    edit: after some fiddling with this i have seen that my assumption that the indicators dont get displayed for items without children is not entirely right. they got shown for childless items, but only when they were previously unchecked (all the items in the tree are set to checkable) and even then they only got shown for a few of them. Sometimes the view doesnt update when hovering over them and DragMoveEvent is called, but only on childless items, so something is not working right here. I would be very thankful if anyone has a clue as how to fix this behaviour.
    Last edited by flautzr; 30th August 2019 at 15:14.

Similar Threads

  1. Replies: 0
    Last Post: 28th June 2019, 13:36
  2. Replies: 5
    Last Post: 4th March 2015, 23:02
  3. Replies: 2
    Last Post: 13th October 2010, 22:51
  4. Replies: 0
    Last Post: 4th May 2010, 11:24
  5. Drag & drop items on the same QTreeView
    By wind in forum Qt Programming
    Replies: 2
    Last Post: 11th October 2006, 15:29

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.