Results 1 to 6 of 6

Thread: Find out when filtering is doing in QSortFilterProxyModel

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Find out when filtering is doing in QSortFilterProxyModel

    Hi guys..
    I’ve used a QSortFilterProxyModel. Now in filtering the tableview (by setFilterRegExp), I want to be warned. But there isn’t nothing such signal in QSortFilterProxyModel that emitted in this case. How can i find out when the filtering is doing?!

  2. #2
    Join Date
    Sep 2012
    Location
    Iran, Tehran
    Posts
    76
    Thanks
    17
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Post Re: Find out when filtering is doing in QSortFilterProxyModel

    You can subclass QSortFilterProxyModel and override QSortFilterProxyModel::setFilterRegExp to emit a signal when it is called.

  3. #3
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Find out when filtering is doing in QSortFilterProxyModel

    yes that is the only way!

  4. #4
    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: Find out when filtering is doing in QSortFilterProxyModel

    Quote Originally Posted by alizadeh91 View Post
    yes that is the only way!
    No, it is not. You can make use of filterAcceptsRow() or filterAcceptsColumn(). Overriding setFilterRegExp doesn't make much sense because it is not a virtual method.
    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.


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

    alizadeh91 (26th February 2013)

  6. #5
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Find out when filtering is doing in QSortFilterProxyModel

    You mean that i override the filterAcceptsRow() ?

  7. #6
    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: Find out when filtering is doing in QSortFilterProxyModel

    Quote Originally Posted by alizadeh91 View Post
    You mean that i override the filterAcceptsRow() ?
    Yes. And detect a change in filter settings. Be aware though that this will make your proxy model much slower.
    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. Replies: 3
    Last Post: 6th June 2011, 13:34
  2. QSortFilterProxyModel not filtering properly
    By freemind in forum Qt Programming
    Replies: 9
    Last Post: 8th August 2010, 01:23
  3. Key filtering
    By phillip_Qt in forum Qt Programming
    Replies: 2
    Last Post: 24th June 2010, 09:10
  4. Replies: 1
    Last Post: 10th January 2008, 14:38

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.