PDA

View Full Version : free movement in QListView



Algos
31st July 2010, 15:20
Hello folks!
Greetings.

I have created a part of my GUI application with an area where the files of a particular pattern in a directory are listed as list view items. I would like to be able to drag the items and drop them at a different order within that same listing. If I use icon view instead, the drag and drop reordering works.

The problem is in the list view. If I don't set the movement to "free" explicitly, the GUI shows that dragging and dropping is not working, as I move the mouse, different items get selected. But if I make the movement free, I can drag the item by clicking on it, but the cursor changes to "not allowed" icon and I cannot drop the item anywhere else in that list ... i.e. the item cannot be moved.

Here is a part of my statements that I am using to display the list view:
listFilesView = new QListView(this);
listFilesView->setViewMode(QListView::ListMode);
listFilesView->setMovement(QListView::Free);
listFilesView->setDragEnabled(true);
listFilesView->setAcceptDrops(true);
listFilesView->setSelectionMode(QAbstractItemView::ExtendedSelect ion);
listFilesView->setDropIndicatorShown(true);
listFilesView->setModel(modelFiles);

If hope these statements give enough info to allow somebody to tell me what I am missing in order to get the drag and drop reorder functionality.what I am missing here?

Thank you.

Algos
1st August 2010, 04:08
No response. Seriously, guy?

Could some at least confirm if drag and drop reordering is even possible with QListView by allowing movement to be "free" or do I have to do some other stuff in the model?

Thanks.