Results 1 to 2 of 2

Thread: Can you reverse the insertRow/removeRow order when D&D in the same view?

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 Can you reverse the insertRow/removeRow order when D&D in the same view?

    It seems that when dropping and dragging within a QTreeView, the natural order is to insert the moved node under it's new parent node first (using beingInsertRows() and endInsertRows() )
    and then Qt automatically calls your model's implementation of removeRows() to remove the node from its previous parent node (using beginRemoveRows() and endRemoveRows() ).
    It is also possible to not implement removeRows() in your model but rather create another method that you call manually to remove the row (still using beginRemoveRows() and endRemoveRows() ).

    Either of these methods becomes problematic for me because my underlying datastructure can only have one of the same node object in it at one time. Therefore I can't insert the same node in a new position and remove it from the old position in my datastructure..

    What would be easier for me is to remove the dragged node first and then reinsert it into the datastructure.

    Before I go to the trouble of implementing this, does anyone know if Qt has a problem with removing the dragged row first and then inserting it rather than the other way around.

    Thanks
    Jeff

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


Similar Threads

  1. Replies: 0
    Last Post: 28th November 2011, 19:03
  2. QTableWidget/RemoveRow
    By navi1084 in forum Qt Programming
    Replies: 0
    Last Post: 28th November 2008, 11:01
  3. RemoveRow problem
    By nategoofs in forum Qt Programming
    Replies: 4
    Last Post: 18th August 2007, 13:11
  4. Reverse Order on QStringList slow...?
    By patrik08 in forum Qt Programming
    Replies: 24
    Last Post: 21st February 2007, 09:32
  5. Drag and drop items in view to sort order
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2006, 19:43

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.