Fix filename trucation issues in Icons View with maximum number of lines

Review Request #112265 - Created Aug. 25, 2013 and submitted

Information
Frank Reininghaus
kde-baseapps
KDE/4.11
304558, 321882
Reviewers
dolphin
cfeck
When the name of a file is too long to be shown inside the maximum number of lines, the last line is elided. However, there are several problems at the moment:

(a) "lastTextLine", which contains the text to be elided, is not assigned the complete remaining text, but only the part that would be put into the last line if there were more lines following. This may be less than what would fit into the line because we try to not break the text at random points.

(b) QFontMetrics::elidedText() is not given the width that is available for the last line (that would be maxWidth), but only the width that would be occupied by the text if there were more lines following (line.naturalTextWidth()).

(c) The variable "nameWidth", which is required to calculate the QRectF that is reserved for the name, is not updated correctly.

The result is that the text is sometimes trucated too early (especially if there would be a line break early in the text if we had more lines available), that there may be insufficient space to show the "...", and that the hover/selection rectangle might be too narrow.

The patch fixes these issues.
Fixes the bugs I linked to. I have not observed any regressions so far in Icons View (also tried to enable some "additional information").

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
Please use QFontMetrics::boundingRect().width(). QFontMetrics::width() is the "advance size", not the bounding rectangle size. Christoph Feck Christoph Feck
Christoph Feck
Commit Hook
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...