PDA

View Full Version : QTreeWidget & drag&drop



pfid
9th November 2010, 10:26
Hi,
I want to enable drag&drop on my QTreeWidget, to enable the user to reorder items with d&d. I do not need to interact with other widgets or applications. Also i dont want to copy items, i just want to move them. According to the documentation:
http://doc.qt.nokia.com/4.7/model-view-programming.html#using-convenience-views

this code of mine should do:



pTreeWidget::pTreeWidget(QWidget* p)
: QTreeWidget(p)
{
setDragEnabled(true);
setDropIndicatorShown(true);
viewport()->setAcceptDrops(true);

setDragDropMode(QAbstractItemView::InternalMove);
}

(i didnt subclass the widget for d&d, but for another purpose)

While i can grab items & drag them, and the drop indicator is also shown, nothing will happen when i drop the item.

Can someone help me & tell me whats missing?