diff options
| author | Peter Penz <[email protected]> | 2012-05-01 23:11:06 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-01 23:14:52 +0200 |
| commit | d76b113ad10fe207ef23d5dd44c63ee076c71521 (patch) | |
| tree | 2cda5384e4036f4f048392548ea75243ce6b7fc2 /src/kitemviews/kitemlistview.cpp | |
| parent | 6a7cb5ff7d29cc636b432a96e0db9ef9f9030527 (diff) | |
Places Panel: Allow hiding of items
Related changes:
- Animate changed items for the details-view in case it is not expandable
- Remove the hardcoded "isHidden"-code in KStandardItemListWidget and
allow derived widgets to define themselves what means "hidden" within
their context.
The current code needs a lot of bugfixing, but lets make this in smaller
steps during the next days...
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 48849a3c1..2177c6296 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1701,17 +1701,22 @@ bool KItemListView::moveWidget(KItemListWidget* widget,const QPointF& newPos) bool startMovingAnim = false; - // When having a grid the moving-animation should only be started, if it is done within - // one row in the vertical scroll-orientation or one column in the horizontal scroll-orientation. - // Otherwise instead of a moving-animation a create-animation on the new position will be used - // instead. This is done to prevent overlapping (and confusing) moving-animations. - const int index = widget->index(); - const Cell cell = m_visibleCells.value(index); - if (cell.column >= 0 && cell.row >= 0) { - if (scrollOrientation() == Qt::Vertical) { - startMovingAnim = (cell.row == m_layouter->itemRow(index)); - } else { - startMovingAnim = (cell.column == m_layouter->itemColumn(index)); + if (m_itemSize.isEmpty()) { + // The items are not aligned in a grid but either as columns or rows. + startMovingAnim = !supportsItemExpanding(); + } else { + // When having a grid the moving-animation should only be started, if it is done within + // one row in the vertical scroll-orientation or one column in the horizontal scroll-orientation. + // Otherwise instead of a moving-animation a create-animation on the new position will be used + // instead. This is done to prevent overlapping (and confusing) moving-animations. + const int index = widget->index(); + const Cell cell = m_visibleCells.value(index); + if (cell.column >= 0 && cell.row >= 0) { + if (scrollOrientation() == Qt::Vertical) { + startMovingAnim = (cell.row == m_layouter->itemRow(index)); + } else { + startMovingAnim = (cell.column == m_layouter->itemColumn(index)); + } } } @@ -2221,6 +2226,12 @@ bool KItemListView::changesItemGridLayout(const QSizeF& newGridSize, bool KItemListView::animateChangedItemCount(int changedItemCount) const { + if (m_itemSize.isEmpty()) { + // We have only columns or only rows, but no grid: An animation is usually + // welcome when inserting or removing items. + return !supportsItemExpanding(); + } + if (m_layouter->size().isEmpty() || m_layouter->itemSize().isEmpty()) { return false; } |
