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

TextEdit paintedWidth is wrong when whitespace exceeds wrap width

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 4.7.3
    • None
    • Win 7
      Qt 4.7.3
      Qt pre 4.7.4 203b5edc04143edce0335c5e62de409c64df4c07

    Description

      In a TextEdit with wrapMode set to other than TextEdit.NoWrap the paintedWidth is wrong when whitespace characters are typed in the end of a line and exceed the wrap width.

      The problem can be seen in the attached application by typing space characters in the end of the first line until the line becomes wider than TextEdit.width. When a space is typed that exceeds the wrap width the value of paintedWidth changes from including all the characters in the first line to including only the characters before the trailing spaces (if there are only spaces in the first line paintedWidth changes to 0).

      The bug is that the trailing spaces are dropped from paintedWidth when wrap width is exceeded. They should be included in paintedWidth.

      Another example:

      The impact of the problem can be seen e.g. in the attached Flickable example taken as is from the TextEdit's documentation here:

      http://doc.trolltech.com/main-snapshot/qml-textedit.html

      When similarly typing spaces to the end of the line beoynd the TextEdit's width the content size of the Flickable doesn't include them and the user can't pan/flick to see the whole line including the spaces. However, the user can use the keys to see the end of the line because ensureVisible() will manually adjust the Flickable's content position beoynd its width. This solution works poorly because if the user then touches the Flickable it bounces back to the content bounds which are the paintedWidth (without the spaces). I.e. the example is broken because of this bug.

      Attachments

        1. texteditwrap.png
          texteditwrap.png
          15 kB
        2. TextEditWrapTest.qml
          2 kB
        3. TextFlickExample.qml
          0.7 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:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes