diff options
| author | Peter Penz <[email protected]> | 2012-03-23 22:26:17 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-03-23 22:31:55 +0100 |
| commit | 3f88f79f862a570b68fe64781955cf7d14124127 (patch) | |
| tree | ef9231ea05a90c495f2d59970f2c251204e97c22 /src/kitemviews/kfileitemlistwidget.cpp | |
| parent | 3fc96ef97bbea25418bb22a18e82f6b874eedb38 (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/kfileitemlistwidget.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index fb0f4df57..5c865d1ca 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -139,7 +139,7 @@ void KFileItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsIte // with the icon. This can happen if the user has minimized the width // of the name-column to a very small value. const qreal minX = m_pixmapPos.x() + m_pixmap.width() + 4 * itemListStyleOption.padding; - if (m_textPos[Name + 1].x() < minX) { + if (m_textPos[Name].x() + columnWidth("name") > minX) { clipAdditionalInfoBounds = true; painter->save(); painter->setClipRect(minX, 0, size().width() - minX, size().height(), Qt::IntersectClip); @@ -347,9 +347,11 @@ void KFileItemListWidget::visibleRolesChanged(const QList<QByteArray>& current, m_dirtyLayout = true; } -void KFileItemListWidget::visibleRolesSizesChanged(const QHash<QByteArray, QSizeF>& current, - const QHash<QByteArray, QSizeF>& previous) +void KFileItemListWidget::columnWidthChanged(const QByteArray& role, + qreal current, + qreal previous) { + Q_UNUSED(role); Q_UNUSED(current); Q_UNUSED(previous); m_dirtyLayout = true; @@ -783,8 +785,8 @@ void KFileItemListWidget::updateDetailsLayoutTextCache() // Elide the text in case it does not fit into the available column-width qreal requiredWidth = option.fontMetrics.width(text); - const qreal columnWidth = visibleRolesSizes().value(role, QSizeF(0, 0)).width(); - qreal availableTextWidth = columnWidth - 2 * columnPadding; + const qreal roleWidth = columnWidth(role); + qreal availableTextWidth = roleWidth - 2 * columnPadding; if (textId == Name) { availableTextWidth -= firstColumnInc; } @@ -796,7 +798,7 @@ void KFileItemListWidget::updateDetailsLayoutTextCache() m_text[textId].setText(text); m_textPos[textId] = QPointF(x + columnPadding, y); - x += columnWidth; + x += roleWidth; switch (textId) { case Name: { @@ -813,7 +815,7 @@ void KFileItemListWidget::updateDetailsLayoutTextCache() } case Size: // The values for the size should be right aligned - m_textPos[textId].rx() += columnWidth - requiredWidth - 2 * columnPadding; + m_textPos[textId].rx() += roleWidth - requiredWidth - 2 * columnPadding; break; default: |
