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

QFontMetrics returns incorrect elided text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.3.1
    • GUI: Font handling
    • None

      QFontMetrics returns the wrong elided text sometimes, perhaps when the original text only has one character.

      When the original text is "5" and give rect width is 5, it returns elided text "5", but it should return an empty string, because by calling `horizontalAdvance` to get the full width of text "5", it actually returns 10. 

       

      The minimal sample code is provided below, you can see that the elided text is truncated 

        1. Screenshot 2023-11-13 165159.png
          7 kB
          Qihao Cheng
        2. FontMetricsTest-1.zip
          2 kB
          Qihao Cheng
        For Gerrit Dashboard: QTBUG-119070
        # Subject Branch Project Status CR V

            esabraha Eskil Abrahamsen Blomfeldt
            qihao Qihao Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change