Results 1 to 1 of 1

Thread: display child rows of qstandarditemmodel in a table view

  1. #1
    Join Date
    Jul 2015
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: display child rows of qstandarditemmodel in a table view

    I have a QStandardItemModel tree layout similar to this

    Qt Code:
    1. 1 ,col,col,col
    2. 1,col,col,col
    3. 21,col,col,col
    4. 77,col,col,col
    5.  
    6. 4 ,col,col,col
    7. 4,col,col,col
    8. 89,col,col,col
    9. 3,col,col,col
    10.  
    11. 7 ,col,col,col
    12. 7,col,col,col
    13. .....
    To copy to clipboard, switch view to plain text mode 



    I can display the root rows only in a QTableView (ie:1,4,7), and the entire tree in a tree view, but the tree view lacks the functionality of the table view, ie: I need to be able to navigate between the cells and edit items using key shortcuts which works well with the QTableView focusNextChild().

    I want to display the children of the root rows in a table view in groups one below the other, so that I can manipulate them directly through the table.

    Alternatively: The main issue is that I cannot get a valid pointer to the parent row of the child row, ie: some cell in row 89 is in focus, I need a pointer to the parent row (row 4) so that I can access all of the children of the parent in a loop (ie: 4, 89, & 3). But I think it would be far more simple if I can manipulate them directly through the table.


    Added after 1 40 minutes:


    Looks like I can use QTableView::setRootIndex to change the group occupying the table. This should work.
    Last edited by qsurvae; 2nd July 2015 at 04:46.

Similar Threads

  1. table view (how to insert rows and columns)
    By narlapavan in forum Qt Programming
    Replies: 1
    Last Post: 14th February 2012, 10:50
  2. Table view with collapsible rows
    By adith387 in forum Newbie
    Replies: 4
    Last Post: 16th September 2010, 15:07
  3. Refreshing one or more rows in a table view
    By William Wilson in forum Qt Programming
    Replies: 4
    Last Post: 25th May 2009, 00:10
  4. How to set two rows in a table view Horizontal header?
    By sivollu in forum Qt Programming
    Replies: 11
    Last Post: 29th April 2009, 04:57
  5. Replies: 2
    Last Post: 23rd July 2008, 17:48

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.