Results 1 to 1 of 1

Thread: QTreeView drag & drop support for complete branch

  1. #1
    Join Date
    May 2020
    Location
    Canada, planet Earth
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QTreeView drag & drop support for complete branch

    Hello all,

    After a long and frustrating time searching for answers on how to create a QTreeView working on a QAbstractItemModel that supports drag & drop, I always found half working examples. I finally found an example that worked:
    http://www.java2s.com/Code/Cpp/Qt/QT...raganddrop.htm

    I was SO happy! But, it was missing one crucial step: It did not copy/move entire branch. It could work with many nodes at once (multi-selection), but it did not copy the children of those nodes.

    I coded the extra step and I wanted to share it with you, so nobody would need to suffer like I did.

    So, here's the code to drag and drop any nodes and their children inside a QTreeView!

    BTW, it is not a professional software, as it do not catch all errors, but it will do what was advertised!

    Attached Files Attached Files

Similar Threads

  1. Replies: 0
    Last Post: 28th June 2019, 13:36
  2. QTreeView Drag and Drop
    By NIteLordz in forum Qt Programming
    Replies: 0
    Last Post: 9th October 2016, 16:32
  3. Replies: 1
    Last Post: 8th January 2011, 13:04
  4. QTreeView: Drag and Drop
    By laugusti in forum Newbie
    Replies: 7
    Last Post: 19th March 2010, 20:05
  5. drag and drop from QTreeView
    By Untersander in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2006, 10:00

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.