Results 1 to 3 of 3

Thread: QSortFilterProxyModel QAbstractItemModel

  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QSortFilterProxyModel QAbstractItemModel

    Hi
    I have a complex QTreeView and a subclasses QAbstractItemModel. Now I want to use QSortFilterProxyModel for filtering. I have some questions:
    Which methods do I have to reimplement in QSortFilterProxyModel? (mapFromSource, mapToSource)
    Am I allowed to add rows and change data via the QAbstractItemModel directly?

    What I have to consider?

    thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QSortFilterProxyModel QAbstractItemModel

    You don't have to reimplement any specific method in QSortFilterProxyModel. Only if you like. A custom filterAcceptsRow() I guess, which is does your filtering.

    And yes, you can change data via the QAbstractItemModel directly, but I would rather use the proxy model. Even if the proxy model watches the source model (http://qt.gitorious.org/qt/qt/blobs/...l.cpp#line1557)

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

    Qiieha (29th October 2012)

  4. #3
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSortFilterProxyModel QAbstractItemModel

    Thank you Lykurg = )

Similar Threads

  1. Replies: 2
    Last Post: 8th December 2010, 20:37
  2. qAbstractItemView, QAbstractItemModel...
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 18th May 2009, 09:22
  3. QAbstractItemModel question
    By awhite1159 in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2008, 09:11
  4. Help needed with QAbstractItemModel
    By Harvey West in forum Qt Programming
    Replies: 11
    Last Post: 27th November 2006, 12:06

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.