'Set the mode used to sort *column*.
**Sort Modes**
value          Compares item.value if available; falls back to text
comparison.
text           Compares item.text()
index          Compares by the order in which items were inserted.
Added in version 0.9.9'

def setSortMode(self, column, mode):

    for r in range(self.rowCount()):
        item = self.item(r, column)
        if hasattr(item, 'setSortMode'):
            item.setSortMode(mode)
    self.sortModes[column] = mode
