diff options
| author | Bojidar Marinov <[email protected]> | 2025-10-30 17:01:32 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-11-04 09:51:30 +0000 |
| commit | 05194fd525071e41678d31b93146fad2e6e2e451 (patch) | |
| tree | b8b5701ef1f8afb0146b29103e4ba4a4f38073f2 /po/ast | |
| parent | 4e89d3b88aabd371ef0b0b10c6a5fc95c8765250 (diff) | |
icon view: fix file names overflowing after text eliding
aba0de7301b060c40d543adbaa8d53cf69a9d7ee re-introduced the usage of QFontMetrics::boundingRect(QString) for calculating the size of the last line of a filename. ..Unfortunately, that function uses a different code path from QTextLayout, and arrives at a shorter width for a line of text.
Meanwhile, QFontMetrics::size(QString) internally uses QFontMetric::boundingRect(QRect, int, QString, ..), which has been documented as "The bounding rectangle returned by this function is somewhat larger than that calculated by the simpler boundingRect() function. This function uses the maximum left and right font bearings as is necessary for multi-line text to align correctly."
I have empirically confirmed that QFontMetricsF::size and QTextLine::naturalTextWidth return the same floating-point value given the same input, and QFontMetrics::size does internally use QTextLine::naturalTextWidth through qt_format_text.
BUG: 432530
Diffstat (limited to 'po/ast')
0 files changed, 0 insertions, 0 deletions
