Results 1 to 2 of 2

Thread: TreeView and selection updating

  1. #1
    Join Date
    Jul 2009
    Location
    Oulu, Finland
    Posts
    23
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default TreeView and selection updating

    Hi everyone,

    Can someone give me a hint about updating selections in QTreeView. The problem is that when I insert a new node to the model and the TreeView gets updated, the selection in the view doesn't follow the node that was selected. Instead it will stick in the same row as it was before and the node in that row is usually already a different one.

    So how to get the selection to follow the actual node?

    -Tepi

  2. #2
    Join Date
    Jul 2009
    Location
    Oulu, Finland
    Posts
    23
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: TreeView and selection updating

    As there's no suggestions on this one, I made a temporary fix for this... For now I'm inserting new nodes only to the bottom of the model/list. So the selection will always be in the right place since the order of nodes isn't changing.

    I think that I could create a new variable for keeping track of the selection and use it whenever the model/view gets updated, but I actually I wanted to know if there's some built-in "Qt's model/view" way of doing this...
    Last edited by Tepi; 29th March 2010 at 09:28.

Similar Threads

  1. TreeView question
    By hasmik in forum Newbie
    Replies: 0
    Last Post: 22nd July 2009, 11:54
  2. QSortfilterProxyModel and Treeview
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 27th March 2009, 12:36
  3. updating treeview from tableview
    By darshan in forum Qt Programming
    Replies: 4
    Last Post: 11th February 2009, 19:53
  4. Proxy for TreeView
    By patrikd in forum Qt Programming
    Replies: 5
    Last Post: 8th February 2008, 19:12
  5. Treeview scrollbar not updating when inserting rows
    By Khal Drogo in forum Qt Programming
    Replies: 11
    Last Post: 29th November 2007, 13:13

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.