【发布时间】:2011-06-03 06:40:15
【问题描述】:
我有两个 QListWidget(list1 和 list2)
-
list1应该可以接收来自list2的物品 -
list1应该能够通过内部拖放进行重组 -
list2应该能够接收来自list1的物品
list1->setSelectionMode(QAbstractItemView::SingleSelection);
list1->setDragEnabled(true);
list1->setDragDropMode(QAbstractItemView::DragDrop);
list1->viewport()->setAcceptDrops(true);
list1->setDropIndicatorShown(true);
ulist2->setSelectionMode(QAbstractItemView::SingleSelection);
list2->setDragEnabled(true);
list2->setDragDropMode(QAbstractItemView::InternalMove);
list2->viewport()->setAcceptDrops(true);
list2->setDropIndicatorShown(true);
我必须将list2 放在InternalMove 上,否则当我将它拖到list1 时,该项目不会被删除。
如果我把list1 放到InternalMove 上,我就不能再继续下去了。
我是否必须编写自己的拖放功能才能做到这一点?
【问题讨论】:
标签: qt drag-and-drop qlistwidget