aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-11-25 13:33:09 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-25 08:10:20 +0100
commit900137ea6a593f612e091cf629fc3a0ec929fb5f (patch)
treedec5a458f88591766375d9f6fd0fcee10355ddd7 /src
parent4ffa4881a8e7a8da85029aaf834aadca9ede0b91 (diff)
Fix searchs for insert positions in QDeclarativeListCompositor.
When scanning for a start range don't stop on ranges that don't have an group flags unless that range is the terminal range. This fixes a couple of issues where moving an item to the end of the list would position it after a prepend only range instead of before it, or would miscalculate the iterator offset resulting in invalid indexes in the insert range. Change-Id: Ic4aa001edf43ec86a65d432cd8f80abf0b44d276 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/util/qdeclarativelistcompositor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/declarative/util/qdeclarativelistcompositor.cpp b/src/declarative/util/qdeclarativelistcompositor.cpp
index 02db70f09d..d73d76e386 100644
--- a/src/declarative/util/qdeclarativelistcompositor.cpp
+++ b/src/declarative/util/qdeclarativelistcompositor.cpp
@@ -199,7 +199,7 @@ QDeclarativeListCompositor::iterator &QDeclarativeListCompositor::iterator::oper
QDeclarativeListCompositor::insert_iterator &QDeclarativeListCompositor::insert_iterator::operator +=(int difference)
{
Q_ASSERT(difference >= 0);
- while (!(range->flags & groupFlag) && (range->flags & (GroupMask | CacheFlag))) {
+ while (!(range->flags & groupFlag)) {
incrementIndexes(range->count - offset);
offset = 0;
range = range->next;
@@ -221,10 +221,10 @@ QDeclarativeListCompositor::insert_iterator &QDeclarativeListCompositor::insert_
QDeclarativeListCompositor::insert_iterator &QDeclarativeListCompositor::insert_iterator::operator -=(int difference)
{
Q_ASSERT(difference >= 0);
- while (!(range->flags & groupFlag) && (range->flags & (GroupMask | CacheFlag))) {
+ while (!(range->flags & groupFlag) && range->previous->flags) {
decrementIndexes(offset);
range = range->previous;
- offset = range->count;
+ offset = (range->flags & (GroupMask | CacheFlag)) ? range->count : 0;
}
decrementIndexes(offset);
offset -= difference;