DnD and ListBox


Hi Jules,

I’m trying to perform a custom DnD operation from a custom widget which use several listBox (A columnView widget) and I’m stuck due to the way DnD is implemented in ListBox.

I was wondering if it could be made more flexible.

Most of the time the ListBoxRowComponent forward to the model
but not in the case of the drag as it only ask for the dragDescription.

But If for example I want to perform a native DnD, I can’t. (let me know if I’ve missed something)

Maybe you could add a listBoxItemDragged in ListBoxModel with a default implementation that does what ListBoxRowComponent do so far ?

IMHO TreeViewItem can have the same kind of functionnality.



Hmm. Could do. Of course, it’s not hard to just give it a custom row component to do all this stuff. Ideally I’d like to keep the listbox model as simple as possible, to avoid loading it with duplicates of all the same things you can already do with a component. The original idea was that it just acts as a convenient way of handling very straightforward lists, but nothing too fancy.


Maybe I’ve missed something but how can you have a custom
ListBoxRowComponent in the current implementation ?

The new is done in ListViewport::updateContents, and I can’t find a way to customize it without rewriting ListBox.





For sure ListBoxRowComponent can have a custom child.
However it seems that ListViewport always create a ListBoxRowComponent.

However maybe mouseDrag is called too in the custom component created in ListBoxRowComponent.

Let me know if you plan to do the modification in the model, or I’ll do the custom component way.



The custom component fills the whole row, so you can do anything you need with it. It gets mouse-drags like any other component.