Results 1 to 5 of 5

Thread: Drag Drop problem with model views

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Drag Drop problem with model views

    Hi Guys

    I've got a QTreeView that I've setup so that I can drag and drop a node within the tree.
    That included reimplementing supportedDropActions(), mimeTypes(), mimeData(const QModelIndexList &indexes), bool dropMimeData(...) and removeRows().

    Most of it works fine:
    When I start the drag, mimeData() is called.
    When I drop the node, dropMimeData(...) gets called - It creates a new node from the mimeData and insert the node into the data structure (between beginInsertRows() and endInsertRows() ).
    It then automatically calls removeRows() which removes the original node.

    But there are some occasions where I need to reject the drop. If I simply return false in dropMimeData,
    the dragged node returns to its original position but then removeRows() is still called and the node gets removed.
    If I set up a flag so that the node isn't removed within removeRows(), it leaves the row there but makes it invisible.

    Does anyone know how to fix this?

    Thanks
    Jeff

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


Similar Threads

  1. Replies: 1
    Last Post: 2nd August 2010, 20:16
  2. Drag and drop between model views
    By larry104 in forum Qt Programming
    Replies: 20
    Last Post: 19th January 2008, 16:09
  3. Replies: 1
    Last Post: 30th November 2007, 11:55
  4. Drag Drop between Different Views
    By aamer4yu in forum Qt Programming
    Replies: 13
    Last Post: 8th December 2006, 04:29
  5. drag and drop with item views
    By castorvert in forum Qt Programming
    Replies: 14
    Last Post: 27th March 2006, 10:12

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
  •  
Qt is a trademark of The Qt Company.