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/kitemlistviewlayouter_p.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/kitemlistviewlayouter_p.h')
| -rw-r--r-- | src/kitemviews/kitemlistviewlayouter_p.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistviewlayouter_p.h b/src/kitemviews/kitemlistviewlayouter_p.h index ebed39a41..017f520fe 100644 --- a/src/kitemviews/kitemlistviewlayouter_p.h +++ b/src/kitemviews/kitemlistviewlayouter_p.h @@ -112,6 +112,18 @@ public: QRectF itemRect(int index) const; QRectF groupHeaderRect(int index) const; + + /** + * @return Column of the item with the index \a index. + * -1 is returned if an invalid index is given. + */ + int itemColumn(int index) const; + + /** + * @return Row of the item with the index \a index. + * -1 is returned if an invalid index is given. + */ + int itemRow(int index) const; /** * @return Maximum number of (at least partly) visible items for @@ -174,7 +186,12 @@ private: qreal m_groupHeaderHeight; qreal m_groupHeaderMargin; - QList<QRectF> m_itemRects; + struct ItemInfo { + QRectF rect; + int column; + int row; + }; + QList<ItemInfo> m_itemInfos; friend class KItemListControllerTest; }; |
