Topic: QWebView, changeover of the selected text

QWebView allows to change structure of the document by a call setInnerXml (or setOuterXml) at any element. Also allows to clarify, what piece of the text is selected at present, but this text has no binding to elements. It would be desirable to connect these two things together, and to change that part of the document which is selected at present. For example, completely to throw out the selected part of the text. Whether is any concerning a simple method to make it?