From e70c2f8aa472c01433f9416c363c698677c5b45f Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 25 Mar 2012 22:56:13 +0200 Subject: Details view: Don't reset to automatic resizing when adding columns Until now when a new column is added in the case where custom column widths are used, the automatic resizing has been turned on again. The patch fixes this so that the current widths stay and the new column gets a proper default width. --- src/kitemviews/kitemlistheaderwidget.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/kitemviews/kitemlistheaderwidget.cpp') diff --git a/src/kitemviews/kitemlistheaderwidget.cpp b/src/kitemviews/kitemlistheaderwidget.cpp index 18b37c246..d3a8f001b 100644 --- a/src/kitemviews/kitemlistheaderwidget.cpp +++ b/src/kitemviews/kitemlistheaderwidget.cpp @@ -98,9 +98,14 @@ bool KItemListHeaderWidget::automaticColumnResizing() const void KItemListHeaderWidget::setColumns(const QList& roles) { + foreach (const QByteArray& role, roles) { + if (!m_columnWidths.contains(role)) { + m_columnWidths.remove(role); + m_preferredColumnWidths.remove(role); + } + } + m_columns = roles; - m_columnWidths.clear(); - m_preferredColumnWidths.clear(); update(); } -- cgit v1.3