diff options
| author | Peter Penz <[email protected]> | 2008-12-13 15:15:04 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-12-13 15:15:04 +0000 |
| commit | d0c97573d4cee67974758349ddcfc2fee509785d (patch) | |
| tree | 9d943833a82d7394c2a0366d6b1521c58f4357ee /src | |
| parent | 99271699f305de4ad25a8c2a6dd7e7307cb61af7 (diff) | |
Especially when using the details view in combination with the split functionality, the size of the name column can get too small. Do an optimized resizing in this case (at least for up to 200 items, otherwise the performance penalty is too big).
svn path=/trunk/KDE/kdebase/apps/; revision=896446
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphindetailsview.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 6b4ef44d0..f92a28e79 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -910,9 +910,26 @@ void DolphinDetailsView::resizeColumns() // resize the name column in a way that the whole available width is used columnWidth[KDirModel::Name] = viewport()->width() - requiredWidth; - if (columnWidth[KDirModel::Name] < 120) { - columnWidth[KDirModel::Name] = 120; + + const int minNameWidth = 300; + if (columnWidth[KDirModel::Name] < minNameWidth) { + columnWidth[KDirModel::Name] = minNameWidth; + + // It might be possible that the name column width can be + // decreased without clipping any text. For performance + // reasons the exact necessary width for full visible names is + // only checked for up to 200 items: + const int rowCount = model()->rowCount(); + if (rowCount < 200) { + const int nameWidth = sizeHintForColumn(DolphinModel::Name); + if (nameWidth + requiredWidth <= viewport()->width()) { + columnWidth[KDirModel::Name] = viewport()->width() - requiredWidth; + } else if (nameWidth < minNameWidth) { + columnWidth[KDirModel::Name] = nameWidth; + } + } } + headerView->resizeSection(KDirModel::Name, columnWidth[KDirModel::Name]); } |
