diff options
| author | Peter Penz <[email protected]> | 2012-02-21 16:46:56 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-21 16:49:38 +0100 |
| commit | 7deb601f317d7c806e69d0d82d99a03d0859ca85 (patch) | |
| tree | 49f4347edb8377156b19e52708a01690795bfd5b /src/kitemviews/kfileitemlistview.cpp | |
| parent | a89bc63f6c2807e92c4e8f9b860ae32d93014e96 (diff) | |
Don't trigger assert when switching to details-view
If the visible roles of the details-view are equal to the visible roles
of other views, then switching to the details-view will trigger an
assert because the invisible roles don't get updated.
Thanks to Frank Reininghaus for the detailed analyses!
In the context of this fix optimizations have been done when switching
view-modes: The "don't-animate-workaround" could be removed.
BUG: 294531
FIXED-IN: 4.8.1
Diffstat (limited to 'src/kitemviews/kfileitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemlistview.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 03f379837..25f7738bf 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -97,8 +97,17 @@ bool KFileItemListView::previewsShown() const void KFileItemListView::setItemLayout(Layout layout) { if (m_itemLayout != layout) { + const bool updateRoles = (m_itemLayout == DetailsLayout || layout == DetailsLayout); m_itemLayout = layout; + if (updateRoles) { + // The details-layout requires some invisible roles that + // must be added to the model if the new layout is "details". + // If the old layout was "details" the roles will get removed. + applyRolesToModel(); + } updateLayoutOfVisibleItems(); + + setSupportsItemExpanding(m_itemLayout == DetailsLayout); } } @@ -234,11 +243,6 @@ QHash<QByteArray, QSizeF> KFileItemListView::visibleRolesSizes(const KItemRangeL return sizes; } -bool KFileItemListView::supportsItemExpanding() const -{ - return m_itemLayout == DetailsLayout; -} - QPixmap KFileItemListView::createDragPixmap(const QSet<int>& indexes) const { if (!model()) { |
