Results 1 to 14 of 14

Thread: How to reset model without collapsing tree?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2014
    Posts
    98
    Thanks
    43
    Thanked 4 Times in 4 Posts
    Platforms
    Windows

    Default How to reset model without collapsing tree?

    I have a QTreeView of a QStandardItemModel. I have a button that allows the user to move a row up in the tree among its siblings, and I do this using QStandardItem.takeRow() and QStandardItem.insertRow().

    In pseudocode, I have:
    Qt Code:
    1. model.beginResetModel()
    2.  
    3. #perform insert and take operations here
    4.  
    5. model.endResetModel()
    6. view.expandAll()
    To copy to clipboard, switch view to plain text mode 
    My concern is that I am doing something wrong because I need to put in the expandAll() for things to work: otherwise when I reset the model the view collapses the entire tree. Is there a way to reset my model without having to re-expand my tree?
    Last edited by neuronet; 20th February 2015 at 17:45.

Similar Threads

  1. SQL Tree Model Help
    By MTK358 in forum Newbie
    Replies: 9
    Last Post: 22nd June 2015, 15:02
  2. QTreeView expansion after model reset
    By d_stranz in forum Qt Programming
    Replies: 3
    Last Post: 3rd December 2014, 23:42
  3. Replies: 1
    Last Post: 29th August 2013, 05:41
  4. Replies: 5
    Last Post: 10th March 2011, 20:06
  5. Replies: 3
    Last Post: 31st March 2008, 21:23

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.