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

Text background color misplaced

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.2, 5.9.1
    • GUI: Text handling
    • None

    Description

      When setting a background color for parts of a text through QTextCharFormat on the text layout, it often happens that the background is a pixel too short on the right side.

      This depends a bit on the font, and size, and the devicePixelRatio. I ran the attached example on macOS, devicePixelRatio 1, but the effect is not limited to that platform.

      Also, the text selection leaves 1-pixel gaps between lines.

      The screenshot from Qt Creator is a project wide search with ctrl+shift+f with https://codereview.qt-project.org/200293 (and dependency) applied, which changes the highlighted text to be painted with formats on the text layout instead of manually. The same can also be observed in Qt Creator when setting the background color for the different parts of the highlighting in Preferences > Text Editor > Fonts & Colors.

      Attachments

        1. monaco_13pt_selection.png
          monaco_13pt_selection.png
          6 kB
        2. monaco_13pt.png
          monaco_13pt.png
          6 kB
        3. qtcreator_search.png
          qtcreator_search.png
          10 kB
        4. textbackground.zip
          4 kB
        5. times_new_roman_13.png
          times_new_roman_13.png
          5 kB

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              con Eike Ziller
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes