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

QHeaderView draws elided text wrong when using a non-default font (size)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.1.0 Alpha
    • 5.15.0
    • Widgets: Itemviews
    • None
    • 4d943846128118e1b9932a17ce6f977a0f4127a5 (qt/qtbase/dev)

    Description

      Consider the attached screenshots of a QTableModel with a vertical header fixed to a custom width and containing long labels which have to be elided. With the default font, elision works as expected but when increasing the font size or changing the font, elision works in unexpected manners. It looks like the text bounding rectangle calculated to derive the text elision uses the default font and not the font set by the style! For example when using elide mode "middle", then the ellipses are definitely not in the middle but almost on the right edge and the letters thereafter look cut off like they actually go outside the header.

      Also attached is a minimal example to create the screenshots.

      Attachments

        1. headerviewbug_490.png
          headerviewbug_490.png
          7 kB
        2. headerviewbug_491.png
          headerviewbug_491.png
          6 kB
        3. headerviewbug.pro
          0.1 kB
        4. headerviewfontmetrics.patch
          1 kB
        5. main.cpp
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            uiohbgq uiohbgq
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes