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

Text item elides string despite TextMetrics reports there is enough space

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.2
    • Quick: Other
    • None
    • Windows

    Description

      The summary describes the problem, more detailed explanation is below.

      There is a bug in either how Text element lays out text when its elide property is set to Text.ElideRight (possibly other elide modes too), or width reported by TextMetrics.

      Say, in our UI we have a Text item which has static geometry, its elide property is set to Text.ElideRight, and for whatever reason we want to pre-format our string that is possibly too long for the label, but we always make sure that the formatted string should fit in the label. To achieve this, we use TextMetrics. So, what I found is that in certain situations Text element elides the string even though TextMetrics says there is enough space for the entire string to be shown.

      To clarify, I don't want to be told that I'm doing something unorthodox and should just set elide property to Text.ElideNone and not bother, I am aware that'd work; it's just an example that demonstrates the issue with eliding algorithm that is used when it shouldn't be.

      Notice how in the attached example this only happens when the Text width is getting smaller; when you're increasing the width, it always works fine.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            olegyadrov-bluescape Oleg Yadrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes