oKcerG / SortFilterProxyModel

A nicely exposed QSortFilterProxyModel for QML
MIT License
298 stars 101 forks source link

ValueFilter does not show results in a hierarchical model #85

Closed arunpkio closed 10 months ago

arunpkio commented 3 years ago

Consider a Tree model with the following structure

  • node1
    • starred {true}
  • parent1
    • node2
      • starred {true}
    • node3
      • starred {false}
  • parent2
    • node4
      • starred {true}
  • node5
    • starred {true}

By using the below ValueFilter

filters: [
            ValueFilter {
                roleName: "starred"
                value: true
            },

I expect the result as

  • node1
    • starred {true}
  • parent1
    • node2
      • starred {true}
  • parent2
    • node4
      • starred {true}
  • node5
    • starred {true}

But what I see is,

  • node1
    • starred {true}
  • node5
    • starred {true}

It does apply the filter only on the top level and not those below.

I could fix this by calling setRecursiveFilteringEnabled(true); in the constructor of QQmlSortFilterProxyModel

Searching withRegExpFilter filter works fine and shows results in all levels correctly.