Results 1 to 5 of 5

Thread: I wanna drag and drop some files into QTreeView

  1. #1
    Join Date
    Sep 2011
    Posts
    5
    Thanked 3 Times in 3 Posts

    Default I wanna drag and drop some files into QTreeView

    Hello

    I'm making messenger program such as MSN or Google Talk.
    I have some problems on FileTransfer.
    To send a file to someone, I need to drag and drop it on member(tree item) of qtreeview.
    (There is a member list on QTreeView subclass.)

    I set "setAcceptDrop" and... changed various properties.
    But it is impossible to drag and drop a file.

    HELP ME !!

    thank you in advance.

  2. The following user says thank you to guri for this useful post:


  3. #2
    Join Date
    Aug 2011
    Posts
    44
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows Symbian S60

    Default Re: I wanna drag and drop some files into QTreeView

    In addition to setAcceptDrops( true ), you should process QEvent:: DragEnter and QEvent:: Drop events at least.
    There are examples on this purpose in Qt (examples/draganddrop, http://doc.qt.nokia.com/latest/examp...aganddrop.html).

  4. The following user says thank you to llev for this useful post:


  5. #3
    Join Date
    Sep 2011
    Posts
    5
    Thanked 3 Times in 3 Posts

    Default Re: I wanna drag and drop some files into QTreeView

    I have already tried to make setAcceptDrops true and describe DragEnteredEvent function.
    But when dragging a file on QTreeView, mouse pointer shows me unavailable icon as below not plus icon.
    1.png

    and I found enter into DragEnteredEvent when a files is dragged on QTreeView but DropEvent doesn't occur.
    Last edited by guri; 28th September 2011 at 01:44.

  6. The following user says thank you to guri for this useful post:


  7. #4
    Join Date
    Aug 2011
    Posts
    44
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows Symbian S60

    Default Re: I wanna drag and drop some files into QTreeView

    Are you sure you accept QEvent::DragEnter (event->accept()) event and consume it for tree view?
    Could you paste a piece of code here?

  8. The following user says thank you to llev for this useful post:


  9. #5
    Join Date
    Sep 2011
    Posts
    5
    Thanked 3 Times in 3 Posts

    Default Re: I wanna drag and drop some files into QTreeView

    I have some missing codes.

    I solved it. event->accept() should be inserted in DragEnter, DragMove event.

    Thank you

  10. The following user says thank you to guri for this useful post:


Similar Threads

  1. QTreeView Drag and Drop
    By theprobe in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2011, 22:08
  2. QTreeView: Drag and Drop
    By laugusti in forum Newbie
    Replies: 7
    Last Post: 19th March 2010, 19:05
  3. Drag and drop in QTreeView
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2008, 09:36
  4. drag and drop from QTreeView
    By Untersander in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2006, 09:00
  5. Drag & drop for QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2006, 14:32

Tags for this Thread

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.