assure that the minimized width can never get larger than the default width

svn path=/trunk/KDE/kdebase/apps/; revision=871881
This commit is contained in:
Peter Penz 2008-10-15 21:41:59 +00:00
parent d39451d6d1
commit 49fd5b1c4b

View 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"