QTreeView Filter



  • Hello all,

    Is it possible to filter a child node only, without showing its parents?
    Example (strings used):

    Parent("okay")
    -Child("cool")
    Parent("cool")
    -Child("cool")

    In my case, I want to match the strings "cool" for example, It would only show that first Child("cool"), and the second parent("cool"), and its Child("cool"), but not the parent of the first node because it doesn't match the string?

    Thanks in advance.



  • If the first parent isn't displayed how would you (conceptually) want to display the child?



  • it is not possible. A tree always starts with the parent index unknown (root aof a tree) and the iterates all childs. From thoes their children etc.
    If you filter out a parent, it's children will never be met, as the parent is out.



  • Of course, it's possible to implement a custom proxy model that applies your filter. I just don't think that something like that is already available in Qt.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.