Nominate our 2022 Qt Champions!

How to draw custom text cursor in QTextEdit?

  • I would like to change the text cursor's shape (not the mouse cursor) in QTextEdit and using the setCursorWidth(int width) method with 8 or 10 (so the shape becomes block) is just fine. But the problem is that the cursor hides the current character. Is it possible to draw my own text cursor and make the text cursor transparent when it is over a character? This is the same behaviour as the Fake Vim Mode's text cursor in Qt Creator or Terminal's cursor.

Log in to reply