'Create a kill ring attached to the specified Qt text edit.'

def __init__(self, text_edit):

    assert isinstance(text_edit, (QTextEdit, QPlainTextEdit))
    super(QtKillRing, self).__init__()
    self._ring = KillRing()
    self._prev_yank = None
    self._skip_cursor = False
    self._text_edit = text_edit
    text_edit.cursorPositionChanged.connect(self._cursor_position_changed)
