From 49fd5b1c4b57abd09babe33de0313b2789256515 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 15 Oct 2008 21:41:59 +0000 Subject: assure that the minimized width can never get larger than the default width svn path=/trunk/KDE/kdebase/apps/; revision=871881 --- src/dolphinfileitemdelegate.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dolphinfileitemdelegate.cpp') 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" -- cgit v1.3