┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinfileitemdelegate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinfileitemdelegate.cpp')
-rw-r--r--src/dolphinfileitemdelegate.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dolphinfileitemdelegate.cpp b/src/dolphinfileitemdelegate.cpp
index 53c1d781e..c0e032570 100644
--- a/src/dolphinfileitemdelegate.cpp
+++ b/src/dolphinfileitemdelegate.cpp
@@ -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"