'Setter for pattern.
Args:
val: The value to set.'

def set_pattern(self, val):

    self._pattern = val
    val = re.sub('    +', '    ', val)
    val = re.escape(val)
    val = val.replace('\\    ', '.*')
    rx = QRegExp(val, Qt.CaseInsensitive)
    self.setFilterRegExp(rx)
    self.invalidate()
    sortcol = 0
    self.sort(sortcol)
