]> cloud.milkyroute.net Git - dolphin.git/commitdiff
assure that the minimized width can never get larger than the default width
authorPeter Penz <peter.penz19@gmail.com>
Wed, 15 Oct 2008 21:41:59 +0000 (21:41 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 15 Oct 2008 21:41:59 +0000 (21:41 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=871881

src/dolphinfileitemdelegate.cpp

index 53c1d781e52c72af7cfc05f8049f27d2145dfef1..c0e032570ce78f228edc6af26ffd30f03b4917fc 100644 (file)
@@ -60,7 +60,13 @@ void DolphinFileItemDelegate::paint(QPainter* painter,
 int DolphinFileItemDelegate::nameColumnWidth(const QString& name, const QStyleOptionViewItem& option)
 {
     QFontMetrics fontMetrics(option.font);
-    return option.decorationSize.width() + fontMetrics.width(name) + 16;  
+    int width = option.decorationSize.width() + fontMetrics.width(name) + 16;
+    
+    const int defaultWidth = option.rect.width();
+    if ((defaultWidth > 0) && (defaultWidth < width)) {
+        width = defaultWidth;
+    }
+    return width;
 }
 
 #include "dolphinfileitemdelegate.moc"