Results 1 to 4 of 4

Thread: Display a subset of the QAbstractItemModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    10
    Qt products
    Qt5
    Platforms
    Unix/X11

    Cool Display a subset of the QAbstractItemModel

    I've created a QAbstractItemModel and uses a tree view to show its contents. What I want to do next is to create another tree view to show a subset of the model. Should I make a copy of a portion of the original model (is there a quick way to do that)? or should the new tree view references the same model? if so, how would the new tree shows a subset of the model ?(say from a ModelIndex to another ModelIndex)

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

    Default Re: Display a subset of the QAbstractItemModel

    In the second view you should use an instance of QSortFilterProxyModel that will filter out the rows from the original model that you don't want.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Generic-enough QAbstractItemModel.
    By hickscorp in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2010, 04:55
  2. plot only subset of the data
    By pospiech in forum Qwt
    Replies: 3
    Last Post: 14th April 2008, 21:19
  3. QAbstractItemModel for dummies
    By morty in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2006, 15:25
  4. Need help with QTreeView/QAbstractItemModel
    By Valheru in forum Qt Programming
    Replies: 5
    Last Post: 28th August 2006, 15:09
  5. why QAbstractitemmodel error on Qt4.1.1?
    By manhds in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2006, 23:34

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
  •  
Qt is a trademark of The Qt Company.