'Qt override.
This is needed to be able to intercept the Tab key press event.'

def event(self, event):

    if (event.type() == QEvent.KeyPress):
        if ((event.key() == Qt.Key_Tab) or (event.key() == Qt.Key_Space)):
            text = self.text()
            cursor = self.cursorPosition()
            if ((cursor != 0) and (text[(cursor - 1)] == '    ')):
                text = (((text[:(cursor - 1)] + ROW_SEPARATOR) + '    ') + text[cursor:])
            else:
                text = ((text[:cursor] + '    ') + text[cursor:])
            self.setCursorPosition(cursor)
            self.setText(text)
            self.setCursorPosition((cursor + 1))
            return False
    return QWidget.event(self, event)
