]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinfileitemdelegate.cpp
Improve the selection performance of the details view by factor of 5 (patch provided...
[dolphin.git] / 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"