aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmllistwrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmllistwrapper.cpp')
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 244b77f76f..eadd95fce8 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -27,11 +27,22 @@ static void setCustomArrayData(Heap::QmlListWrapper *d)
o->setArrayType(Heap::ArrayData::Custom);
}
+void Heap::QmlListWrapper::init(QMetaType propertyType)
+{
+ Object::init();
+ m_object.init();
+ m_propertyType = propertyType.iface();
+ m_ownData = new QObjectList;
+ *property() = QQmlListProperty<QObject>(nullptr, m_ownData);
+ setCustomArrayData(this);
+}
+
void Heap::QmlListWrapper::init(QObject *object, int propertyId, QMetaType propertyType)
{
Object::init();
m_object.init(object);
m_propertyType = propertyType.iface();
+ m_ownData = nullptr;
void *args[] = { property(), nullptr };
QMetaObject::metacall(object, QMetaObject::ReadProperty, propertyId, args);
setCustomArrayData(this);
@@ -43,6 +54,7 @@ void Heap::QmlListWrapper::init(
Object::init();
m_object.init(object);
m_propertyType = propertyType.iface();
+ m_ownData = nullptr;
*property() = list;
setCustomArrayData(this);
}
@@ -50,6 +62,7 @@ void Heap::QmlListWrapper::init(
void Heap::QmlListWrapper::destroy()
{
m_object.destroy();
+ delete m_ownData;
Object::destroy();
}
@@ -69,6 +82,11 @@ ReturnedValue QmlListWrapper::create(
->asReturnedValue();
}
+ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, QMetaType propType)
+{
+ return engine->memoryManager->allocate<QmlListWrapper>(propType)->asReturnedValue();
+}
+
QVariant QmlListWrapper::toVariant() const
{
if (!d()->object())