Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to change hieght of the visible text cursor in QTextEdit?



  • The standard for rich text applications is to change the size of the visible text cursor for subscript and superscript formats. See a screenshot from Microsoft Word below.
    f2183b47-846c-4652-8b27-f66bbfe188b9-image.png
    However, the default QTextEdit doesn't do this. Here's a screenshot of this PySide6 example
    d33c6837-b5d9-41be-a838-e60f92364e3d-image.png

    The size of the text cursor is a visual indicator that subscript/superscript have been enabled or disabled, so this is a UX issue. I can hack the cursor height by changing the font, but this isn't suitable when the QTextEdit is writable.

    There's a cursorWidth method for QTextEdit but I couldn't find a way to change the text cursor's height. Is there a built-in way to do this without writing a custom paint method?


Log in to reply