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

Selection highlight overlaps with next character when aligning center horizontally

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.8.4, 4.8.5, 5.1.1
    • Fix Version/s: 4.8.6, 5.2.0
    • Component/s: GUI: Text handling
    • Labels:
      None
    • Environment:
      Arch Linux x86/x86_64
      Microsoft Windows XP Professional SP3
      Microsoft Windows 7 Ultimate SP1 64-bit
    • Commits:
      c368cbad3a505d44894ff150dc25c74d0174ca15 5d8a882c11201a29475c5ea71cfb76c9de6573f5

      Description

      If text is aligned center horizontally, the selection highlight can overlap with the next character. It seems to be a rounding issue as increasing the layout width by 1 pixel fixes the overlap. Increase width by another pixel again and there is overlap. It cycles every 2 pixels. This doesn't occur when aligning left or right.

      This can be seen in several places:
      -QTextEdit - run the Rich Text example, higlight "Text" in "QTextEdit" title and resize the window width
      -QTextLayout - see attached example
      -QML Text item with a span having different background for the selected text (Qt Quick 1.1) - see https://bugreports.qt-project.org/browse/QTBUG-34218
      -QML TextEdit - see https://bugreports.qt-project.org/browse/QTBUG-34220

        Attachments

        1. QTBUG-34234.cpp
          1 kB
        2. QTBUG-34234.png
          QTBUG-34234.png
          23 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            net147 Jonathan Liu
            Reporter:
            net147 Jonathan Liu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes