[Qt-interest] Moving items in QListView

Oliver Demetz forenbeitraege at oliverdemetz.de
Tue Jun 2 15:11:43 CEST 2009


Hi!

I want to be able to *move items* is my QListView (or more precise: my 
QListWidget).

Moving itself is already possible, but only to end of the list or where 
a free place is available.

What I want to realise is to be able to *change the order* of the items.

My code is as follows:

     list = new QListWidget;
     list->setViewMode(QListView::IconMode);
     list->setMovement(QListView::Snap);
     list->setDragDropMode(QAbstractItemView::InternalMove);

     list->setFlow(QListView::LeftToRight) ;
     list->setWrapping(true);
     list->setUniformItemSizes(true);
     list->setResizeMode(QListView::Adjust);

It would be great to have such a marker between two items while dragging 
the item to be moved, as it is shown eg when moving the entries in the 
Windows start menu around. See the black bar in attached file "move.png".

Thanks in advance,
best regards,
Oliver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move.png
Type: image/png
Size: 6219 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090602/d9e4fec2/attachment.png 


More information about the Qt-interest-old mailing list