I'm using PySide(PyQt is fine as well) and I want to deselect everything inside a QTextEdit. Selecting everything is very easy and it's done by self.textedit.selectAll(), but I can't find a simple way to deselect everything. Is there a straightforward way to do it that I'm not aware of or is it more complicated than that?
Thanks.
You want to first get the
QTextCursorfor theQTextEditThen clear the selection of the
QTextCursorThen update the
QLineEditwith the newQTextCursor(see documentation forQTextEdit.textCursor()which indicates updating the returnedQTextCursordoes not actually affect theQTextEditunless you also call the following)