Results 1 to 3 of 3

Thread: Get target Object for drag and drop in QTreeWidget

  1. #1
    Join Date
    Sep 2017
    Posts
    6
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Get target Object for drag and drop in QTreeWidget

    I am currently working on dragging a treeWidgetItem to two different treeWidgets. Is there any way to let me get target treeWidget in dragMoveEvent(QDragMoveEvent *event) or other function when I am dragging a treeWidgetItem so that I can some animation effect to the target TreeWidget?

    Also, can I get the itemIndex for the position of my mouse when I am dragging the item to another TreeWidget? Thank you very much.
    Last edited by ng2b30; 14th June 2019 at 11:48.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,359
    Thanks
    36
    Thanked 1,533 Times in 1,484 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Get target Object for drag and drop in QTreeWidget

    Not quite sure I understand you first question.

    The "dragMoveEvent" handler is in your target class, no?

    As for position: the event object has a position and the view has an indexAt() method.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2017
    Posts
    6
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Get target Object for drag and drop in QTreeWidget

    Quote Originally Posted by anda_skoa View Post
    Not quite sure I understand you first question.

    The "dragMoveEvent" handler is in your target class, no?

    As for position: the event object has a position and the view has an indexAt() method.

    Cheers,
    _
    The "dragMoveEvent" handler can be my target class but I can also use other class. Any suggestion?

    Is there any way to directly get the target treeWidgetitem instead of comparing their position? Thank you.

Similar Threads

  1. Drag & drop in QTreeWidget
    By Maluna34 in forum Qt Programming
    Replies: 0
    Last Post: 27th June 2017, 10:09
  2. Replies: 3
    Last Post: 8th October 2010, 19:01
  3. QTreeWidget Drag and drop
    By zell99 in forum Newbie
    Replies: 15
    Last Post: 7th August 2010, 13:28
  4. Replies: 2
    Last Post: 14th May 2010, 14:12
  5. QtreeWidget drag and drop
    By addu in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2009, 09:41

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.