┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-03-23 22:26:17 +0100
committerPeter Penz <[email protected]>2012-03-23 22:31:55 +0100
commit3f88f79f862a570b68fe64781955cf7d14124127 (patch)
treeef9231ea05a90c495f2d59970f2c251204e97c22 /src/kitemviews/kfileitemlistview.cpp
parent3fc96ef97bbea25418bb22a18e82f6b874eedb38 (diff)
Details view: Optionally remember user changed column-widths
If the user changed a column-width in the details-view, up to now the width got reset when changing a directory or when restarting Dolphin. Now the column-widths automatically get remembered for each directory in case if the user has modified the width. The automatic resizing is still turn on per default. The storing of the custom column-width can easily be reset by right clicking on the header and selecting "Automatic Column Widths" from the context-menu. Some finetuning is still necessary (e.g. the "Adjust View Properties" dialog currently is not aware about this setting) but this will be fixed during the next weeks. BUG: 264434 FIXED-IN: 4.9.0
Diffstat (limited to 'src/kitemviews/kfileitemlistview.cpp')
-rw-r--r--src/kitemviews/kfileitemlistview.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index 54d858c1e..483dabb83 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -193,12 +193,12 @@ QSizeF KFileItemListView::itemSizeHint(int index) const
return QSize();
}
-QHash<QByteArray, QSizeF> KFileItemListView::visibleRolesSizes(const KItemRangeList& itemRanges) const
+QHash<QByteArray, qreal> KFileItemListView::columnWidths(const KItemRangeList& itemRanges) const
{
QElapsedTimer timer;
timer.start();
- QHash<QByteArray, QSizeF> sizes;
+ QHash<QByteArray, qreal> widths;
int calculatedItemCount = 0;
bool maxTimeExceeded = false;
@@ -208,10 +208,10 @@ QHash<QByteArray, QSizeF> KFileItemListView::visibleRolesSizes(const KItemRangeL
for (int i = startIndex; i <= endIndex; ++i) {
foreach (const QByteArray& visibleRole, visibleRoles()) {
- QSizeF maxSize = sizes.value(visibleRole, QSizeF(0, 0));
+ qreal maxWidth = widths.value(visibleRole, 0);
const QSizeF itemSize = visibleRoleSizeHint(i, visibleRole);
- maxSize = maxSize.expandedTo(itemSize);
- sizes.insert(visibleRole, maxSize);
+ maxWidth = qMax(itemSize.width(), maxWidth);
+ widths.insert(visibleRole, maxWidth);
}
if (calculatedItemCount > 100 && timer.elapsed() > 200) {
@@ -238,7 +238,7 @@ QHash<QByteArray, QSizeF> KFileItemListView::visibleRolesSizes(const KItemRangeL
}
kDebug() << "[TIME] Calculated dynamic item size for " << rangesItemCount << "items:" << timer.elapsed();
#endif
- return sizes;
+ return widths;
}
QPixmap KFileItemListView::createDragPixmap(const QSet<int>& indexes) const