PDA

View Full Version : Retrieving exact info on target(s) of drop indicator in a subclassed QTreeWidget



Daniel Dekkers
17th March 2010, 16:12
Hi,

I'm implementing drag and drop in a subclassed QTreeWidget. The drop indicator shows either a rectangle if the mouse cursor is on an item and a horizontal line if the mouse cursor is exactly between two items (or at the start or end of a list of items).

How can i extract this information in my dropEvent(QDropEvent *p_Event)? At the moment i'm using itemAt(p_Event->pos()) to get the target item, but that isn't enough for above mentioned.

Any ideas?

Kind Regards,
Daniel Dekkers

osiris81
14th May 2010, 13:26
Hi,

I have exactly the same problem.

It is not possible to find out where the horizontal line was when using "itemAt(event->pos())".

Is there another way to find out where the horizontal line has been?

osiris81
14th May 2010, 14:12
I found a solution.

QAbstractItemView::dropIndicatorPosition() shows the indicator position:

QAbstractItemView::OnItem
QAbstractItemView::AboveItem
QAbstractItemView::BelowItem
QAbstractItemView::OnViewport