Results 1 to 3 of 3

Thread: tableView shows part of model

  1. #1
    Join Date
    Jan 2015
    Posts
    8
    Thanks
    7
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default tableView shows part of model

    Hi

    I would like to set into the tableview "part of data in a child" of my model.
    rootIndex will show me ALL item of a child. But, I need to show part of a child in a certain tableview.

    Cheers,
    Omid

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: tableView shows part of model

    You could use a proxy model to filter out the rows/columns you don't want to appear.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    Omid123 (14th February 2015)

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: tableView shows part of model

    To expand on anda_skoa's answer, you need a class derived from QSortFilterProxyModel that reimplements the QSortFilterProxyModel::filterAcceptsRow() and / or QSortFilterProxyModel::filterAcceptsColumn() methods. These methods return true if the row or column should be displayed, false if not. You set your current model as the source model for the proxy, and you set the proxy as the model used by the view.

  5. The following user says thank you to d_stranz for this useful post:

    Omid123 (14th February 2015)

Similar Threads

  1. QLineEdit shows always the end, how shows start ?
    By Alundra in forum Qt Programming
    Replies: 8
    Last Post: 19th June 2015, 12:09
  2. tableView shows hierarchical model
    By Omid123 in forum Newbie
    Replies: 1
    Last Post: 3rd February 2015, 23:37
  3. Tableview after Model move section
    By poporacer in forum Newbie
    Replies: 5
    Last Post: 14th September 2011, 01:13
  4. tableview , model and owncolumn
    By maston in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2010, 11:00
  5. How to view just a part of a model ?
    By weepdoo in forum Qt Programming
    Replies: 8
    Last Post: 11th June 2007, 10:14

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.