Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSortFilterProxyModel filter by multiple coloumns
QtWS25 Last Chance

QSortFilterProxyModel filter by multiple coloumns

Scheduled Pinned Locked Moved General and Desktop
qsortfilterproxfiltering
2 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    beetle
    wrote on last edited by
    #1

    Hello, i'm hoping for some help here.

    Im having problems with filtering data. I have two QLineEdits, one is connected to filter the first column in table model, the other is connected to filter the second coloumn. For example if I filter by first coloumn, table refreshes and shows only rows with that paritucular regExp, but when I filter with coloumn one and then with coloumn two, filterRegExp ignores the coloumn one and filteres the model only by second column.
    I know that filterRegExp searches the whole source model and that's the problem. After filtering with first column I want to filter the filtered table model, not the whole model. Is there a way to achieve this?

    Thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      You could stack two QSortFilterProxyModels on top of the each other, one filtering on the first column/value, and the other on the second column/value.

      Alternatively, you could subclass QSortFilterProxyModel to override filterAcceptsRow() and compare two columns against two filter values (the first is the existing column and value, and a second you add)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved