Results 1 to 2 of 2

Thread: QTreeView Drag and Drop: Copying heirarchy

  1. #1
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QTreeView Drag and Drop: Copying heirarchy

    Hi,

    I have two QTreeViews side by side connected to a single QAbstractItemModel through two QSortFilterProxyModel each implementing a distinct filter on the model. I have implemented the methods required for DnD.

    I can drag an item from one view, drop it into the other view and create a copy of the item data using the setItemData() method. However, if the item dragged is a parent of other items in the model I can't get the children copied as well (only the parent gets copied with no children inserted below). I've tried the linkAction but that doesn't seem to help either.

    Does the model DnD mechanism support copying/moving whole hierarchies of items out of the box? If not, can anyone suggest how I might go about it?

    Thanks

  2. #2
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView Drag and Drop: Copying heirarchy

    I eventually have managed to do this by storing the source item in the model, which I then accessed when doing the copy, to copy its descendants and thereof. Strange Qt doesn't support this type of deep copy...

Similar Threads

  1. QTreeView Drag and Drop
    By theprobe in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2011, 22:08
  2. Moving vs. copying in drag and drop
    By lana in forum Newbie
    Replies: 5
    Last Post: 29th July 2010, 18:41
  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.