Hello !
(Sorry for my english)
I am currently trying to make a drag & drop in a QTreeWidget. So I put the corresponding settings and the method dropEvent :
Qt Code:
{ protected: { if (!index.isValid()) { // just in case event->setDropAction(Qt::IgnoreAction); return; } qDebug() << "drop on item" << item->text(0); } }; int main() { TreeWidget *listWidget = new TreeWidget; listWidget->setDragEnabled(true); listWidget->viewport()->setAcceptDrops(true); listWidget->setDropIndicatorShown(true); }To copy to clipboard, switch view to plain text mode
But in my case, I would like to move only parent items. In the code, I get the destination item, but how get dragged item ?
Have I to overload a drag method ? Launch the drag myself from mousePressEvent ? What is the best way to do ?
Thanks !
Bookmarks