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

QTextDocument height includes leading of last line

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.0.0
    • GUI: Text handling
    • None
    • All

    Description

      Discovered while investigating while fixing QTBUG-80554.

      When calculating the content height of a QTextDocument, the layout uses the y coordinate already found for the "next" line (plus margins). If the font has a positive leading value, this will be included, which is wrong.

      There is negligible effect of this, but it can be seen when checking the height of a QLabel with/without TextSelectableByMouse set (like in tst_QLabel::sizeHint()). One uses qt_format_text() to calculate the height, whereas the other goes via a QTextDocument. If the font has a positive leading, then the text document height may be > the other one if the ceil(ascent + descent) is lower than ceil(ascent + descent + leading).

      The remedy for QTBUG-80554 triggered a failure in tst_QLabel::sizeHint() on some platforms.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes