- def filter(self, filter):
- print self.filterModel.rowCount(), self.nodeModel.rowCount()
- self.filterModel.setFilterRegExp(QRegExp(filter))
+ def filter(self, filter_string):
+ # for hierarchical models QSortFilterProxyModel applies the
+ # sort recursively. if the parent doesn't match the criteria
+ # we won't be able to match the children. so we need to match
+ # parent (by matching the network_names)
+ networks = ["^%s$" % n for n in self.network_names]
+ filters = networks + [str(filter_string)]
+ self.filterModel.setFilterRegExp(QRegExp('|'.join(filters)))