summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2010-09-14 14:49:57 (GMT)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2010-09-14 14:49:57 (GMT)
commit34b805d66c09fb324d1b6a7bcf259e8743ef3894 (patch)
tree3567ce5e2e8b0463c2e932e38940a92b814ab00c /src/gui/graphicsview
parenta8085e53f15f88aa108d2e7e6473094105d0fdcb (diff)
downloadQt-34b805d66c09fb324d1b6a7bcf259e8743ef3894.zip
Qt-34b805d66c09fb324d1b6a7bcf259e8743ef3894.tar.gz
Qt-34b805d66c09fb324d1b6a7bcf259e8743ef3894.tar.bz2
Completing the interface for children/data/resources
This patch makes the handling of properties like children and data easier in Bauhaus. Especially in the case of property alias Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7a5b8de..9e43f2f 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7676,6 +7676,13 @@ QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGra
return 0;
}
+void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObject> *list)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ for (int index = 0 ;index < d->children.count();index++)
+ QGraphicsItemPrivate::get(d->children.at(index))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+}
+
/*!
Returns a list of this item's children.
@@ -7689,7 +7696,7 @@ QDeclarativeListProperty<QGraphicsObject> QGraphicsItemPrivate::childrenList()
if (isObject) {
QGraphicsObject *that = static_cast<QGraphicsObject *>(q);
return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append,
- children_count, children_at);
+ children_count, children_at, children_clear);
} else {
//QGraphicsItem is not supported for this property
return QDeclarativeListProperty<QGraphicsObject>();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index d60dffb..cce9439 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -487,6 +487,7 @@ public:
static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
static int children_count(QDeclarativeListProperty<QGraphicsObject> *list);
static QGraphicsObject *children_at(QDeclarativeListProperty<QGraphicsObject> *list, int);
+ static void children_clear(QDeclarativeListProperty<QGraphicsObject> *list);
inline QTransform transformToParent() const;
inline void ensureSortedChildren();