]> cloud.milkyroute.net Git - dolphin.git/commit
Make the handling of the "maximum text lines" setting more robust
authorFrank Reininghaus <frank78ac@googlemail.com>
Mon, 24 Feb 2014 20:05:09 +0000 (21:05 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Mon, 24 Feb 2014 20:05:09 +0000 (21:05 +0100)
commit342822e83de4508a7e32bf9c23ee074c2d584d48
tree888ec0bf9a09db0d8adb2e23c8e5caf958ff04dc
parent0d37038b407944a9b7ec05127b5b6d41dc1a496f
Make the handling of the "maximum text lines" setting more robust

If the user sets a maximum number of text lines in the settings, this
number was translated into a maximum height in pixels using
QFontMetrics::lineSpacing() before this commit.

In KStandardItemListWidgetInformant::itemSizeHint(), this maximum height
limited the size that is reserved for the item.

However, in KStandardItemListWidget::updateIconsLayoutTextCache(), the
maximum height was translated back into a maximum number of lines,
which limits the number of lines that are created using the QTextLayout.

This approach could lead to problems if the real height of the layouted
text is 1 pixel more or less than QFontMetrics::lineSpacing() times
"number of lines".

Now we do not store a "maximum height" inside the "maximum size"
explicitly, but store a maximum number of lines and a maximum with (for
Compact View) separately, and then use the number of lines also to
calculate the required size in
KStandardItemListWidgetInformant::itemSizeHint(). This should make sure
that the correct height is reserved for each item.

Thanks to Christoph Feck and Emmanuel Pescosta for helping to debug this
problem and testing the patch.

BUG: 323841
FIXED-IN: 4.13
REVIEW: 113871
src/kitemviews/kitemliststyleoption.cpp
src/kitemviews/kitemliststyleoption.h
src/kitemviews/kitemlistview.cpp
src/kitemviews/kstandarditemlistwidget.cpp
src/views/dolphinitemlistview.cpp