diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-10-08 06:12:31 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-10-08 06:12:31 (GMT) |
commit | 11536f150887266b6a6f5cf00b22f9d1fcc1aaeb (patch) | |
tree | 529b7577371d359c3f9bf573e2b8c2de3e52513c /src/declarative/graphicsitems | |
parent | fd2d104988955e4e94252abd8d90507aa33dc10d (diff) | |
download | Qt-11536f150887266b6a6f5cf00b22f9d1fcc1aaeb.zip Qt-11536f150887266b6a6f5cf00b22f9d1fcc1aaeb.tar.gz Qt-11536f150887266b6a6f5cf00b22f9d1fcc1aaeb.tar.bz2 |
Ensure GridView header is visible at the top of the view.
The view was scrolled to the top of the first item, rather than
the top of the header.
Task-number: QTBUG-13906
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 8216ab7..6ee6b0d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -218,7 +218,14 @@ public: return visibleItems.last()->rowPos() + rows * rowSize(); } } else { - return (modelIndex / columns) * rowSize(); + qreal pos = (modelIndex / columns) * rowSize(); + if (header) { + qreal headerSize = flow == QDeclarativeGridView::LeftToRight + ? header->item->height() + : header->item->width(); + pos += headerSize; + } + return pos; } return 0; } |