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

QHeaderView draws elided text incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.4.0 Beta
    • 4.8.0, 5.3.2, 5.4.0 Alpha
    • Widgets: Itemviews
    • None

    Description

      When setting elide mode to for a header view, text rect is determined incorrectly - if alignment is set to Qt::AlignLeft and elide mode is set to Qt::ElideRight, last letter of a text doesn't fit in sections' rect in some cases (there should be three '.', but sometimes only two are drawn).
      Also there's other problem with Qt::AlignRight and Qt::ElideRight - despite to elide mode, first letter is not draw completely and text aligned to right border (inlike tree view, which aligns text to the left in case if text is too long to fit in item's rect).
      This happen because in case of QHeaderView QCommonStyle calls viewItemDrawText, which calls QPainter::drawText with rect AND alignment.
      In case of tree view, style calculates alignedRect (with width equal to qMin(textWidth, itemRectWidth) and draws text with LEFT alignment ALWAYS.
      I would like to see same behavior in QHeaderView as in QTreeView (jumping first letter is very annoying)

      Attachments

        1. align left.jpg
          align left.jpg
          24 kB
        2. align right.jpg
          align right.jpg
          23 kB
        3. qt.patch.QTBUG-24772.diff
          0.9 kB
        4. QTBUG-24772.png
          QTBUG-24772.png
          12 kB
        5. QTBUG24772.tar.gz
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cristian.onet Cristian Oneț
            arch Ivan Komissarov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes