summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2010-09-15 17:05:09 (GMT)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2010-09-15 17:05:09 (GMT)
commit1d30c86ab0b0c609c68bb53adc633b3da8b2863d (patch)
tree164bbf954ba2ce1054f66de6b9bcac1a2dc3c005 /src/declarative/graphicsitems
parente0087081ff6088a284dff30a3ec7e24684236588 (diff)
downloadQt-1d30c86ab0b0c609c68bb53adc633b3da8b2863d.zip
Qt-1d30c86ab0b0c609c68bb53adc633b3da8b2863d.tar.gz
Qt-1d30c86ab0b0c609c68bb53adc633b3da8b2863d.tar.bz2
Fix bug in 34b805d66c09fb324d1b6a7bcf259e8743ef3894
This time the implementation of clear is correct Reviewed-by: Marco Bubke
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index bf3d88b..5a94afb 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -1069,8 +1069,9 @@ static inline QObject *children_at_helper(QGraphicsObject *object, int index)
static inline void children_clear_helper(QGraphicsObject *object)
{
QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(object);
- for (int index = 0 ;index < d->children.count();index++)
- QGraphicsItemPrivate::get(d->children.at(index))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+ int childCount = d->children.count();
+ for (int index = 0 ;index < childCount; index++)
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
}
int QDeclarativeFlickablePrivate::data_count(QDeclarativeListProperty<QObject> *prop)
@@ -1087,7 +1088,7 @@ QObject *QDeclarativeFlickablePrivate::data_at(QDeclarativeListProperty<QObject>
const int j = i - resourcesCount;
QGraphicsObject *contentObject = static_cast<QDeclarativeFlickablePrivate*>(prop->data)->contentItem;
if (j < children_count_helper(contentObject))
- children_at_helper(contentObject, j);
+ return children_at_helper(contentObject, j);
return 0;
}
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 53a4710..0ac616d 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1638,8 +1638,9 @@ static inline QObject *children_at_helper(QDeclarativeListProperty<QObject> *pro
static inline void children_clear_helper(QDeclarativeListProperty<QObject> *prop)
{
QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(prop->object));
- for (int index = 0 ;index < d->children.count();index++)
- QGraphicsItemPrivate::get(d->children.at(index))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+ int childCount = d->children.count();
+ for (int index = 0 ;index < childCount; index++)
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
}
int QDeclarativeItemPrivate::data_count(QDeclarativeListProperty<QObject> *prop)
@@ -1654,7 +1655,7 @@ QObject *QDeclarativeItemPrivate::data_at(QDeclarativeListProperty<QObject> *pro
return resources_at(prop, i);
const int j = i - resourcesCount;
if (j < children_count_helper(prop))
- children_at_helper(prop, j);
+ return children_at_helper(prop, j);
return 0;
}