Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86823

REG: Blinking cursor leaving an artifact in QTextEdit

XMLWordPrintable

    • Windows
    • e99a883bd382ca950192bd66cafb2a1de6394ce7 (qt/qtbase/dev) 9b0ffccabd0bf668b052b0ce74980cc3a0b859e5 (qt/qtbase/6.0) bed37717886721888d87a80911a3403df9ef46c9 (qt/qtbase/6.1) b7c4b74146 (qt/tqtc-qtbase/5.15) b7c4b74146 (qt/tqtc-qtbase/tqtc/vxworks-5.15.10)

      Our Qt product has recently tried to upgrade from Qt 5.10 to 5.15.1. 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.

      The artifact is the black line at the top of the blinking cursor that doesn't disappear.

      We're using a QTextImageFormat when inserting the image.

       

      QTextImageFormat format;
      format.setName(svgFileLocation);QSvgRenderer renderer(svgFileLocation);}}
      const auto height = 19;
      QImage image(height, height, QImage::Format_ARGB32);
      image.fill(Qt::transparent);
      QPainter painter(&image);
      renderer.render(&painter);{{// This line causes the cursor blinking issues!}}
      // Comment out this line and the blinking cursor is fixed (but the format is not correct)
      format.setVerticalAlignment(QTextCharFormat::AlignBottom);

       

      The line of code that causing problems is:
      format.setVerticalAlignment(QTextCharFormat::AlignBottom);

      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!)

      format.setVerticalAlignment(QTextCharFormat::AlignBaseline);

       

      I've attached 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.

       

      Has something else changes around QTextImageFormat that we're not aware of that's causing this bug?

        1. CursorIssue.zip
          23 kB
          Liam Frawley
        2. macos-11.2-qt6.2.mov
          64 kB
          Shawn Rutledge
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mise Liam Frawley
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: