mirror of https://github.com/qt/qt3d.git
Fix qml list interface for resources and data in quickitem3d
Task-number: QTBUG-9390 Change-Id: I205eb9a8737f999b7705975c876183b31077406f Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
parent
ab11368985
commit
6b8ee028ac
|
@ -312,6 +312,7 @@ public:
|
|||
static QObject *resources_at(QQmlListProperty<QObject> *, int);
|
||||
static void resources_append(QQmlListProperty<QObject> *, QObject *);
|
||||
static int resources_count(QQmlListProperty<QObject> *);
|
||||
static void resources_clear(QQmlListProperty<QObject> *);
|
||||
|
||||
// transform property
|
||||
static int transform_count(QQmlListProperty<QQuickQGraphicsTransform3D> *list);
|
||||
|
@ -551,6 +552,13 @@ int QQuickItem3DPrivate::resources_count(QQmlListProperty<QObject> *prop)
|
|||
return prop->object->children().count();
|
||||
}
|
||||
|
||||
void QQuickItem3DPrivate::resources_clear(QQmlListProperty<QObject> *property)
|
||||
{
|
||||
QObjectList children = property->object->children();
|
||||
foreach (QObject *child, children)
|
||||
child->setParent(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Applies position, scale and rotation transforms for this item3d to matrix
|
||||
|
@ -998,7 +1006,8 @@ QQmlListProperty<QObject> QQuickItem3D::resources()
|
|||
{
|
||||
return QQmlListProperty<QObject>(this, 0, QQuickItem3DPrivate::resources_append,
|
||||
QQuickItem3DPrivate::resources_count,
|
||||
QQuickItem3DPrivate::resources_at);
|
||||
QQuickItem3DPrivate::resources_at,
|
||||
QQuickItem3DPrivate::resources_clear);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1012,7 +1021,7 @@ QQmlListProperty<QObject> QQuickItem3D::resources()
|
|||
*/
|
||||
QQmlListProperty<QObject> QQuickItem3D::data()
|
||||
{
|
||||
return QQmlListProperty<QObject>(this, 0, QQuickItem3DPrivate::data_append);
|
||||
return QQmlListProperty<QObject>(this, 0, QQuickItem3DPrivate::data_append, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue