Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.8.0, 5.3.2, 5.4.0 Alpha
-
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
For Gerrit Dashboard: QTBUG-24772 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
95523,2 | Fix the drawing of elided text in QHeaderView. | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |