def METHOD_NAME(self):
    # Grab the text cursor
    cursor = self.parent.text.textCursor()
    # Security
    if cursor.hasSelection():
        # We insert the new text, which will override the selected
        # text
        cursor.insertText(self.replaceField.toPlainText())
        # And set the new cursor
        self.parent.text.setTextCursor(cursor)