Deselect in a QTextEdit

I’m using Qt 2.6.3.

You may notice QTextEdit is nice enough to have a find(), which most inputs (QLineEdit, QComboBox) do not.

Thing is, as I’m implementing my find function, I’d like to deselect any previous selections as I move along. Otherwise things get quite confusing.

And QTextEdit does not have any kind of deselect(). QLineEdit does, which is nice, but you get the picture.

And lo I’m Googling and trying to figure out how to deselect so I can implement it in my custom textedit field that inherits from QTextEdit.

And lo I notice in the method directly beneath the deselect() I’m trying to write THIS IS ALREADY IMPLEMENTED.

Here’s how you do it:


    def deselect(self):

        self.moveCursor(QTextCursor.End)
        self.moveCursor(QTextCursor.Left)

LOLOLOLLERSKATE!

You’re welcome.

(643 visits, 3 today)