diff options
| author | Peter Penz <[email protected]> | 2012-02-17 16:00:52 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-17 16:02:14 +0100 |
| commit | 51bd6cfdfad4d1be706f6dc125762889c19fcc5a (patch) | |
| tree | 4b8d555bb0513a7a385a8e10ccba8622141bdee9 /src/kitemviews/kitemlistview.h | |
| parent | a5becac42cded392b957e71fcd433082c604a41f (diff) | |
Remember the row- and column-information for visible items
Up to now KItemListView has not been aware to which column or row
an item belongs to. This has been handled internally in
KItemListViewLayouter. But for deciding whether a move-animation
might result in overlapping items it is mandatory to be aware about
the column/row. The current approach to guess a column/row change
by comparing the source- and target-rectangle works very well but
breaks on some corner-cases when e.g. zooming.
Now the layouter allows to access the information. This assures
that in the vertical alignment no move-animation is done between
rows and the in the horizontal alignment no move-animation is
done between the columns.
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 118ed2f03..293f4b1ec 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -381,15 +381,28 @@ private: * the same row or column, otherwise the create-animation is used instead. * @return True if the moving-animation has been applied. */ - bool moveWidget(KItemListWidget* widget, const QRectF& itemBounds); + bool moveWidget(KItemListWidget* widget, const QPointF& newPos); void emitOffsetChanges(); KItemListWidget* createWidget(int index); void recycleWidget(KItemListWidget* widget); + + /** + * Changes the index of the widget to \a index. The cell-information + * for the widget gets reset and will be updated in the next doLayout(). + */ void setWidgetIndex(KItemListWidget* widget, int index); /** + * Changes the index of the widget to \a index. In opposite to + * setWidgetIndex() the cell-information of the widget gets updated. + * This update gives doLayout() the chance to animate the moving + * of the item visually (see moveWidget()). + */ + void moveWidgetToIndex(KItemListWidget* widget, int index); + + /** * Helper method for prepareLayoutForIncreasedItemCount(). */ void setLayouterSize(const QSizeF& size, SizeType sizeType); @@ -550,6 +563,15 @@ private: QHash<int, KItemListWidget*> m_visibleItems; QHash<KItemListWidget*, KItemListGroupHeader*> m_visibleGroups; + struct Cell + { + Cell() : column(-1), row(-1) {} + Cell(int c, int r) : column(c), row(r) {} + int column; + int row; + }; + QHash<int, Cell> m_visibleCells; + int m_scrollBarExtent; KItemListSizeHintResolver* m_sizeHintResolver; KItemListViewLayouter* m_layouter; |
