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

QTextEdit truncates displayed text when setting colors via QTextCharFormat if LineWrapMode is NoWrap

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.17, 5.2.0
    • GUI: Text handling
    • None
    • Windows 7 64-bit with MSVC 2010

    Description

      If you have a QTextEdit with a sufficiently high enough line count, the QTextEdit widget will truncate the displayed text if you switch the LineWrapMode to "NoWrap" and you are using QTextCharFormat to change the text color and/or background color – both mergeCharFormat and setCharFormat behave the same.

      I have replicated this on both Qt 4.8.4 and Qt 5.2.0. The environment was on Windows 7 64 with MSVC 2010, as noted. It's believed to do the same on other platforms, but I haven't tested it on others yet.

      Attached is a small test-case that exhibits the behavior. Copy the included testdata.txt file to the same folder you are running the .exe from. As presented it will truncate what is shown. If you either comment out line 48 of MainWindow.cpp with the setLineWrapMode to NoWrap or if you comment out line 69 with the call to mergeCharFormat, it will display the entire content, but without the desired wrap mode or text highlighting (respectively).

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            dewhisna Donna Whisnant
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes