From: Peter Penz Date: Wed, 15 Oct 2008 21:41:59 +0000 (+0000) Subject: assure that the minimized width can never get larger than the default width X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/49fd5b1c4b57abd09babe33de0313b2789256515 assure that the minimized width can never get larger than the default width svn path=/trunk/KDE/kdebase/apps/; revision=871881 --- 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"