[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Peter Penz <peter.penz19 () gmail ! com>
Date:       2010-11-16 20:45:05
Message-ID: 20101116204505.3640BAC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1197864 by ppenz:

If additional information is shown, we just apply the maximum width as size-hint. The \
alternative solution for having an optimized width would be to do a very expensive \
layout already for the size-hint, where also eliding must be respected. Considering \
that showing additional information most probably will anyhow consume the available \
width, this expensive approach is not used.

BUG: 256986


 M  +11 -1     kfileitemdelegate.cpp  


--- trunk/KDE/kdelibs/kio/kio/kfileitemdelegate.cpp #1197863:1197864
@@ -370,9 +370,10 @@
     layout.setText(text);
 
     layout.beginLayout();
+    const qreal maxLineWidth = qreal(maxWidth);
     while ((line = layout.createLine()).isValid())
     {
-        line.setLineWidth(int(maxWidth));
+        line.setLineWidth(maxLineWidth);
         height += leading;
         line.setPosition(QPoint(0, height));
         height += int(line.height());
@@ -479,6 +480,15 @@
     setLayoutOptions(layout, option);
 
     QSize size = layoutText(layout, label, maxWidth);
+    if (!info.isEmpty())
+    {
+        // As soon as additional information is shown, it might be necessary that
+        // the label and/or the additional information must get elided. To prevent
+        // an expensive eliding in the scope of displaySizeHint, the maximum
+        // width is reserved instead.
+        size.setWidth(maxWidth);
+    }
+
     return addMargin(size, TextMargin);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic