diff options
| author | Peter Penz <[email protected]> | 2012-03-25 22:56:13 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-03-25 22:58:16 +0200 |
| commit | e70c2f8aa472c01433f9416c363c698677c5b45f (patch) | |
| tree | 46ae0ce49bf98749ce3a3d6a4b06e6129a7c706d /src/kitemviews/kitemlistheaderwidget.cpp | |
| parent | 1cbe55b97c3b8fd9265ad6b40ce6cc169d4451c1 (diff) | |
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.
Diffstat (limited to 'src/kitemviews/kitemlistheaderwidget.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistheaderwidget.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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<QByteArray>& 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(); } |
