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

QTextLayout::FormatRange foreground not consistently applied

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • GUI: Painting
    • None
    • Linux/X11

    Description

      When passed as "selection" formats at draw()-time, a `QList<QTextLayout::FormatRange>` might fail to properly apply foreground color for each of those formats, unless a (possibly fully translucent) background is set as well.

      Attached, please find a very small testcase reproducing the issue:

      • when the testcase is run without arguments (e.g., `./test-layout`), the bug shows: the 2nd `D` letter should be red (like the rest), but shows as black
      • when the testcase is run with (any) argument (e.g., `./test-layout 1`), it will also apply a fully-translucent background color to the `QTextLayout::FormatRange` - in that case, Qt manages to apply the foreground properly.

      Note: the same does not happen when the `QList<QTextLayout::FormatRange>` is set directly on the layout by calling `QTextLayout::setFormats`: it seems to only occur when passed as "selections".

      Attachments

        1. test-layout-bug.png
          test-layout-bug.png
          9 kB
        2. test-layout-no_bug.png
          test-layout-no_bug.png
          4 kB
        3. test-layout.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            aundro Arnaud Diederen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes