I have two list widgets, list1 and list2. With the following codes, I am able to drag and drop between the two list widgets.

Qt Code:
  1. QListWidget *list1 = new QListWidget(this);
  2. QListWidgetItem *__qlistwidgetitem = new QListWidgetItem(list1);
  3. __qlistwidgetitem->setIcon(icon);
  4. ...
  5. list1->setDragEnabled(true);
  6. list1->setDragDropMode(QAbstractItemView::DragDrop);
  7.  
  8. QListWidget *list2 = new QListWidget(this);
  9. list2->setDragDropOverwriteMode(true);
  10. list2->setDragDropMode(QAbstractItemView::DragDrop);
To copy to clipboard, switch view to plain text mode 

However, when I drag an item from list1 and drop into list2, the item stays in list1. I would want the item to be moved into list2. Another problem is that how can I, with a click of a tool button, clear the item from list2 back into list1?

Appreciate any help. Thanks!