From 6ea2a1cdb728635f9bd3cf239f751d4e88610881 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 25 Jul 2022 14:24:19 +0200 Subject: QQmlListAccessor: Accept QQmlListProperty So far we have only accepted QQmlListReference. However, we can also pass a QQmlListProperty around as value. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-105137 Change-Id: I7d4cd3048b62594298f91013c4cda5ec864a28df Reviewed-by: Fabian Kosmale Reviewed-by: Andrei Golubev --- src/qmlmodels/qqmllistaccessor.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/qmlmodels/qqmllistaccessor.cpp') diff --git a/src/qmlmodels/qqmllistaccessor.cpp b/src/qmlmodels/qqmllistaccessor.cpp index 244a1b369d..d68d0a2b90 100644 --- a/src/qmlmodels/qqmllistaccessor.cpp +++ b/src/qmlmodels/qqmllistaccessor.cpp @@ -39,6 +39,7 @@ void QQmlListAccessor::setList(const QVariant &v) d = d.value().toVariant(); variantsType = d.metaType(); } + if (!d.isValid()) { m_type = Invalid; } else if (variantsType == QMetaType::fromType()) { @@ -49,6 +50,9 @@ void QQmlListAccessor::setList(const QVariant &v) m_type = VariantList; } else if (variantsType == QMetaType::fromType>()) { m_type = ObjectList; + } else if (variantsType.flags() & QMetaType::IsQmlList) { + d = QVariant::fromValue(QQmlListReference(d)); + m_type = ListProperty; } else if (variantsType == QMetaType::fromType()) { m_type = ListProperty; } else if (variantsType.flags() & QMetaType::PointerToQObject) { -- cgit v1.2.3