code: def set_filter(self, text):
          
          self.pattern = get_search_regex(text)
          if self.pattern:
              self._parent.setSortingEnabled(False)
          else:
              self._parent.setSortingEnabled(True)
          self.invalidateFilter()
docs: Set regular expression for filter.