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

A wrapping TextEdit's cursor not drawn in the end of a line after whitespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 4.7.3
    • None
    • Win 7
      Qt 4.7.3
      Qt pre 4.7.4 203b5edc04143edce0335c5e62de409c64df4c07

    Description

      A wrapping TextEdit can incorrectly omit painting the cursor when it's in the end of a line outside the TextEdit and preceded by whitespace.

      In the attached picture Test.png it can be seen that a user has typed 'Test' and a space into a TextEdit. The cursor can be seen blinking on the right side of the TextEdit.

      The problem is that sometimes in the same situation the cursor isn't drawn. In the attached picture TesX.png the user has similarly typed a word and a space. The cursor is on the right side of the TextEdit but isn't drawn.

      Also simply typing multiple spaces in the end of a line will always eventually move the cursor out of the TextEdit into a position where the cursor won't be drawn anymore.

      TextEdit should draw its cursor in all these situations. The application should be able to decide where to clip the text and the cursor.

      Additional details:

      • If a cursorDelegate is defined that is drawn correctly
      • It seems drawing the cursor is omitted here:
        void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *painter,
                                                   const QAbstractTextDocumentLayout::PaintContext &context,
                                                   QTextFrame *frame) const
        {
        ...
            if (context.clip.isValid()
                && (off.y() > context.clip.bottom() || off.y() + fd->size.height.toReal() < context.clip.top()
                    || off.x() > context.clip.right() || off.x() + fd->size.width.toReal() < context.clip.left()))
                return;
        ...
        

      Attachments

        1. CursorTest.qml
          0.8 kB
        2. Test.png
          Test.png
          2 kB
        3. TesX.png
          TesX.png
          3 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              denexter Andrew den Exter (closed Nokia identity) (Inactive)
              suistoma Jussi Suistomaa
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes