Results 1 to 4 of 4

Thread: Question about a model with multiple views

  1. #1
    Join Date
    Jun 2008
    Location
    Glenwood, NJ USA
    Posts
    32
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Question about a model with multiple views

    I have subclassed the QAbstractItemModel for a custom data structure and would like to utilize a splitter with a treeview and a tableview. I would like the treeview to only see the first column but the tableview to see all the columns. I looked at QSortFilterProxyModel but not sure if this is my answer. Will I need separate models to solve this problem?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Question about a model with multiple views

    Quote Originally Posted by awhite1159 View Post
    Will I need separate models to solve this problem?
    No, QSortFilterProxyModel is the answer.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Question about a model with multiple views

    QTreeView::setColumnHidden() is also a solution.

  4. #4
    Join Date
    Jun 2008
    Location
    Glenwood, NJ USA
    Posts
    32
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Question about a model with multiple views

    Thanks. My apologies for all these questions. I have a good C++ programming background but must admit after only working/learning Qt for about a month, it can be pretty overwhelming with its feature/function richness. On top of that, I only do this as a hobby as I find programming to be good mental exercise.

    Again thanks for your quick replies.

Similar Threads

  1. Replies: 3
    Last Post: 31st March 2008, 21:23
  2. Drag and drop between model views
    By larry104 in forum Qt Programming
    Replies: 20
    Last Post: 19th January 2008, 16:09
  3. 2 Views 1 Model
    By PrimeCP in forum Qt Programming
    Replies: 3
    Last Post: 2nd October 2007, 01:40
  4. Replies: 4
    Last Post: 20th September 2007, 13:11
  5. Logging to a file and using same model for diff views
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 10th May 2007, 23:16

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.