diff options
author | Matt Vogt <matthew.vogt@jollamobile.com> | 2015-06-22 17:40:02 +1000 |
---|---|---|
committer | Matthew Vogt <matthew.vogt@qinetic.com.au> | 2015-06-23 05:27:02 +0000 |
commit | 2869aa5bc5f05db83f0627de6dfe61b9df0a4d9e (patch) | |
tree | 71ac0adbd82d787829a941a18b2ea355847aa5dd /src/quick/items/qquickgridview.cpp | |
parent | 93c1b8cc6bb7feb922a1cd5d038db6b488745eaa (diff) |
ListView/GridView contentHeight should include delayRemove-d items
When one or more items are in delayRemove state, the ListView's
contentHeight property should include their height. This previously
failed if the delayRemove items were at the end of the visibleItems
list. Also applies to GridView.
Change-Id: Id839e850367a3503123e8ac81dac6ebdccef1a1f
Reviewed-by: Martin Jones <martin.jones@qinetic.com.au>
Diffstat (limited to 'src/quick/items/qquickgridview.cpp')
-rw-r--r-- | src/quick/items/qquickgridview.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 3cc0a28b87..e3f216b3a2 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -267,9 +267,13 @@ qreal QQuickGridViewPrivate::originPosition() const qreal QQuickGridViewPrivate::lastPosition() const { qreal pos = 0; - if (model && model->count()) { - // get end position of last item - pos = (rowPosAt(model->count() - 1) + rowSize()); + if (model && (model->count() || !visibleItems.isEmpty())) { + qreal lastRowPos = model->count() ? rowPosAt(model->count() - 1) : 0; + if (!visibleItems.isEmpty()) { + // If there are items in delayRemove state, they may be after any items linked to the model + lastRowPos = qMax(lastRowPos, static_cast<FxGridItemSG*>(visibleItems.last())->rowPos()); + } + pos = lastRowPos + rowSize(); } return pos; } |