Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, August 2007
QTreeWidget Multiple Item Selection Drag-Drop Reverses Order


Message 1 in thread

Hi Everyone,
This seems kinda obvious so hopefully I'm just doing something silly.  
If I select multiple items in a QTreeWidget and then drag them within  
itself the order of the moved items will reverse themselves. I have  
DragDropMode = InternalMove, DragEnabled = true, SelectionMode =  
ContiguousSelection. Has anyone noticed this behavior and know a good  
way to fix it?

Thanks,

Benjamin Poiesz
bpoiesz1@xxxxxxx



Message 2 in thread

On mandag den 27. August 2007, Benjamin Poiesz wrote:
> Hi Everyone,
> This seems kinda obvious so hopefully I'm just doing something silly.
> If I select multiple items in a QTreeWidget and then drag them within
> itself the order of the moved items will reverse themselves. I have
> DragDropMode = InternalMove, DragEnabled = true, SelectionMode =
> ContiguousSelection. Has anyone noticed this behavior and know a good
> way to fix it?

I'm 95% certain that the order of items in a drag is undefined. If this isn't 
what you intend, you make the drag hold a single entry, which is a list. For 
QTreeWidget, you can't do this.

I think you have to approach a solution from the other end: Make your drop be 
able to handle drags in any order.

Another thing: Unless you are dragging your own special mime types, your drop 
area might receive drops from other applications. And for those, you 
obviously have to worry about the ordering at drop point.

Bo.

-- 
 [ signature omitted ]