Results 1 to 3 of 3

Thread: QSortFilterProxyModel fixed string filtering

  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,053
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default QSortFilterProxyModel fixed string filtering

    I implemented filtering on a QAbstractTableModel using an out-of-the-box QSortFilterProxyModel and the method QSortFilterProxyModel::setFilterFixedString(). Based on what was in the source table model and my filter string, I kept getting too many results.

    Finally resorting to qDebug(), I discovered to my surprise that the filtering was selecting every index that contained the filter string, not those that were an exact match. I would have expected that for searching a fixed filter string, exact matching should be the behavior.

    Has this been the behavior all along, or has something been broken? Using Qt 5.9.

    I finally resorted to using a QRegExp filter with a reg exp that forced exact matching to my string.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    441
    Thanked 60 Times in 56 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel fixed string filtering


  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,053
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QSortFilterProxyModel fixed string filtering

    Thanks, I see. I guess my interpretation of the term "fixed string" is different from that of the implementers.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Custom QSortFilterProxyModel for filtering large data
    By ednakram in forum Qt Programming
    Replies: 7
    Last Post: 24th January 2017, 09:26
  2. Find out when filtering is doing in QSortFilterProxyModel
    By alizadeh91 in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2013, 22:00
  3. Replies: 3
    Last Post: 6th June 2011, 13:34
  4. QSortFilterProxyModel not filtering properly
    By freemind in forum Qt Programming
    Replies: 9
    Last Post: 8th August 2010, 01:23
  5. Replies: 1
    Last Post: 10th January 2008, 14:38

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.