[Qt-interest] QTreeWidget - Dragging and Dropping to move items
David Ching
dc at dcsoft.com
Mon May 18 23:17:19 CEST 2009
David Ching wrote:
> Hello, I have started with http://www.qtsoftware.com/developer/faqs/588
> of a
> QTreeWidget which allows dragging and dropping. But I want to drag and
> drop
> to MOVE top-level items within the tree, to change their order.
> ...
>
> Another scheme would be to, when the drag is started, insert a dummy
> item at
> the bottom of the tree so the user can drop on that to insert at the
> bottom.
> Then remove the dummy item when the drop is complete. I've
> experimented
> with that but had issues with autoscrolling sometimes not showing the
> new
> dummy item. But perhaps this would be easier to get working?
>
FWIW, I did get this working very well, but I had to set the autoscroll
properties of the tree widget to autoscroll by pixels and not by items, this
makes it easy for the user to hover below the list to get it to autoscroll
the dummy item into view, then move the cursor up to drop the item directly
onto the dummy item.
A horizontal line showing the insertion point would still be nicer, but I've
no idea how to drop it on top of the tree widget while the drag is in
progress.
-- David
More information about the Qt-interest-old
mailing list