PDA

View Full Version : Drag and drop from outside or Within the Application onto QTreeWidget.



vaibhav
2nd December 2010, 09:50
Hi,
I am writing application for drag and drop on QTreeWidget which has to perform following action.

1.Drag and Drop File/Folder within the QTreewidget.

2.Drag File/Folder from outside application and Drop it into my Application's QTreewidget.

I have successfully implemented ( 1. ) scenario by reimplementing the dropMimeData(QTreeWidgetItem * pDestItem, int nIndex, const QMimeData * pMimeData, Qt::DropAction action ) function of QTreewidget .


Here pDestItem is the dropped location (Destination location of Treewidget.)

For the ( 2. ) scenario i didnt Recieve any dropMimeData() event (As information is dragged from outside application).
So i reimplemented the drag Enter Event and Drag Leave and Drop Event for TreeWidget.With this i got the information of Dragged Item Successfully.


THE PROBLEM I AM FACING.

==> Now i didnt Receive dropMimeData() for 1st Senario as it is Over rided by Drag enter Event .

==> How to get the dropped location (Destination location of Treewidget.) in Drop Event() Function .?

Any Help Would be Appreciated...

bothorsen
2nd December 2010, 10:02
Did you remember to call setDragDropMode(QAbstractItemView::DragDrop)?

vaibhav
2nd December 2010, 10:06
Yes i have done that and i can drag drop on my Qtreewidget .
Please Look for the problem i am Facing in the above post ..

Thanx..