PDA

View Full Version : Drag and Drop indicator Position



whitefurrows
12th July 2011, 15:50
Hi,

i have reimplement the dragMoveEvent from a QTreeWidget, to know if the drop is on the item, before it or after it. A Drop before should not allowed.


void MyTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{
if ( this->dropIndicatorPosition() == QAbstractItemView::AboveItem )
{
event->ignore();
}
}

The event was only ignored before and after the dragged item. Whats going wrong?

Thanks

high_flyer
14th July 2011, 11:35
Try this:


void MyTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{
if ( this->dropIndicatorPosition() == QAbstractItemView::AboveItem )
{
event->ignore();
return;
}

event->accept();
}