Wiplash
2nd June 2012, 11:26
Hello
I try to program a QTreeView, that enables user to
1. pick an item of class A and to drop it on class B, B will take that item and insert it into his subtree.
2. Class A items can not be dropped on other items of class A
this->setDragEnabled(true);
this->setAcceptDrops(true);
this->setDragDropMode(InternalMove);
this->setDefaultDropAction(Qt::MoveAction);
this->setDropIndicatorShown(true);
this->setAnimated(true);
this->setAutoScroll(true);
this->setWordWrap(true);
this->setAlternatingRowColors(true);
this->setAutoScroll(true);
QTreeView::dropEvent(event);
The items are dropped correctly, but the drop leaves an empty item in place from which the item was dragged. What to do about this?
I try to program a QTreeView, that enables user to
1. pick an item of class A and to drop it on class B, B will take that item and insert it into his subtree.
2. Class A items can not be dropped on other items of class A
this->setDragEnabled(true);
this->setAcceptDrops(true);
this->setDragDropMode(InternalMove);
this->setDefaultDropAction(Qt::MoveAction);
this->setDropIndicatorShown(true);
this->setAnimated(true);
this->setAutoScroll(true);
this->setWordWrap(true);
this->setAlternatingRowColors(true);
this->setAutoScroll(true);
QTreeView::dropEvent(event);
The items are dropped correctly, but the drop leaves an empty item in place from which the item was dragged. What to do about this?