PDA

View Full Version : How do I show the drop indicator BETWEEN rows, not on them in QTreeView



supertwang
17th April 2007, 22:19
Hi there,

I'm trying to create a (flat) list that allows items to be dragged into a new order. I'm using QTreeView ( I like how it looks ) with a flat heirarchy and a subclassed QAbstractItemModel. I've gotten drag n' drop reordering of the list to work, but the drop sites that get shown are rectangles that surround the current row/column element that I am over. What I'd like to show is a thick horizontal line drawn BETWEEN the rows where I will drop the selected items.

Can anyone tell me what I need to override, or what setting I need to make, to influence how the drop targets get shown in QTreeView?

Thanks!
Dave

wysota
18th April 2007, 01:39
http://www.qtcentre.org/forum/f-qt-programming-2/t-drag-and-drop-indicator-6503.html

supertwang
19th April 2007, 19:56
Hi Dave

This is currently a lot harder than it should be. You basically have to
it yourself.

I've shown how you can do this in the attached example. I've also
created a task for the developers about this issue. You can track the
progress of the task here:

http://www.trolltech.com/developer/task-tracker/index_html?id=159200&method=entry

best regards

Anders Bakken - Support Engineer
--
Trolltech Inc

jpn
19th April 2007, 20:16
With wysota's suggestion (http://www.qtcentre.org/forum/f-qt-programming-2/t-drag-and-drop-indicator-6503.html) it would be this simple. Maybe not as pretty though.

mentalmushroom
26th September 2011, 13:02
It looks like the drop indicator is shown for only one column. In my application I need to move whole rows, so I'd like to show drop indicator as wide as the row. Is it possible?