┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-05-20 19:00:33 +0000
committerPeter Penz <[email protected]>2010-05-20 19:00:33 +0000
commit87cd992e85effd14938f67c0671ef2e7cb93a8a7 (patch)
treeec0250a559826f5588f51f677015b29282b91bb5 /src
parent6777da99dfcdc471a4e3b18fe93150b021c86420 (diff)
Fix issue that the columns "Link Destination" and "Path" are shown outside the visible area when enabling them. Also it is assured, that the headline text does not get clipped per default.
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=1128951
Diffstat (limited to 'src')
-rw-r--r--src/dolphindetailsview.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index ee4d3e42e..961bd7872 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -1006,16 +1006,30 @@ void DolphinDetailsView::resizeColumns()
QHeaderView* headerView = header();
QFontMetrics fontMetrics(viewport()->font());
+ // Calculate the required with for each column and store it in columnWidth[]
int columnWidth[DolphinModel::ExtraColumnCount];
const int defaultWidth = fontMetrics.width("xxxxxxxxxx");
+
for (int i = 0; i < DolphinModel::ExtraColumnCount; ++i) {
- columnWidth[i] = defaultWidth;
+ const int logicalIndex = headerView->logicalIndex(i);
+ const QString headline = model()->headerData(logicalIndex, Qt::Horizontal).toString();
+ const int headlineWidth = fontMetrics.width(headline);
+
+ columnWidth[i] = qMax(defaultWidth, headlineWidth);
+ }
+
+ const int defaultSizeWidth = fontMetrics.width("00000 Items");
+ if (defaultSizeWidth > columnWidth[DolphinModel::Size]) {
+ columnWidth[DolphinModel::Size] = defaultSizeWidth;
+ }
+
+ const int defaultTimeWidth = fontMetrics.width("0000-00-00 00:00");
+ if (defaultTimeWidth > columnWidth[DolphinModel::ModifiedTime]) {
+ columnWidth[DolphinModel::ModifiedTime] = defaultTimeWidth;
}
- columnWidth[DolphinModel::Size] = fontMetrics.width("00000 Items");
- columnWidth[DolphinModel::ModifiedTime] = fontMetrics.width("0000-00-00 00:00");
int requiredWidth = 0;
- for (int i = KDirModel::Size; i <= KDirModel::Type; ++i) {
+ for (int i = KDirModel::Size; i < DolphinModel::ExtraColumnCount; ++i) {
if (!isColumnHidden(i)) {
columnWidth[i] += 20; // provide a default gap
requiredWidth += columnWidth[i];
@@ -1023,7 +1037,7 @@ void DolphinDetailsView::resizeColumns()
}
}
- // resize the name column in a way that the whole available width is used
+ // Resize the name column in a way that the whole available width is used
columnWidth[KDirModel::Name] = viewport()->width() - requiredWidth;
const int minNameWidth = 300;