Qt World Summit: Submit your Presentation

Blinking cursor leaving an artifact in QTextEdit

  • Our Qt product has recently tried to upgrade from Qt 5.10 to 5.15. We worked through most of our issues with only a few outstanding. One of them is proving very difficult and stubborn!

    We have a blinking cursor in a QTextEdit that's leaving an artifact while blinking after an image is inserted into the QTextEdit. You can clearly see this in the animated GIF below.

    We're using a QTextImageFormat when inserting the image.

        QTextImageFormat format;
        QSvgRenderer renderer(svgFileLocation);
        const auto height = 19;
        QImage image(height, height, QImage::Format_ARGB32);
        QPainter painter(&image);
        // This line causes the cursor blinking issues!
        // Comment out this line and the blinking cursor is fixed (but the format is not correct)

    The line of code that causing problems is:


    The above line didn't work in Qt 5.10 ... we needed to use the line below instead (and this doesn't work in Qt 5.15!)


    Here's a link to a Visual Studio solution and qrc file that reproduces the problem. It's a tiny little app with a total of 50 lines of code.

    Is this a known bug or has something else changes around QTextImageFormat that we're not aware of?

  • Lifetime Qt Champion


    Looks like it could be a regression. To see if it's known, the best thing to do is to check the bug report system.

    You might want to first test with the latest release of Qt 5.15 to see if it has been fixed in between,

  • Thanks @SGaist
    I created a bug here: https://bugreports.qt.io/browse/QTBUG-86823
    It's been triaged and is a P2

Log in to reply