Results 1 to 3 of 3

Thread: Drag and drop from outside or Within the Application onto QTreeWidget.

  1. #1
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Drag and drop from outside or Within the Application onto QTreeWidget.

    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:ropAction 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...

  2. #2
    Join Date
    Mar 2008
    Location
    Marslev, Denmark
    Posts
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Drag and drop from outside or Within the Application onto QTreeWidget.

    Did you remember to call setDragDropMode(QAbstractItemView:ragDrop)?
    Bo Thorsen, Viking Software
    Qt applications on Linux and Windows

  3. #3
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Drag and drop from outside or Within the Application onto QTreeWidget.

    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..
    Last edited by vaibhav; 2nd December 2010 at 10:17.

Similar Threads

  1. QTreeWidget Drag and drop
    By zell99 in forum Newbie
    Replies: 15
    Last Post: 7th August 2010, 13:28
  2. QTreeWidget: Drag and Drop
    By laugusti in forum Qt Programming
    Replies: 0
    Last Post: 11th June 2010, 15:37
  3. QtreeWidget drag and drop
    By addu in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2009, 09:41
  4. QTreeWidget drag/drop
    By s_a_white in forum Newbie
    Replies: 1
    Last Post: 10th February 2007, 22:04
  5. Drag and drop with QTreeWidget
    By JSPoly in forum Qt Programming
    Replies: 5
    Last Post: 6th February 2007, 22:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.