diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-20 01:00:27 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-01-20 07:04:47 +0000 |
commit | b9519d9630d9192cb49b97c7c9fe30d43ab1ee4a (patch) | |
tree | 512b32a0e2dea84a89a01e89a1b7868f3c1c8a37 /src/qmlmodels | |
parent | 0ced82a8cf8472a79b08db05d441caf778ac9131 (diff) | |
parent | e5f7c5f2712957d0e1753c629e4cce86a0e6bdbc (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/qml/qml/qqmlvaluetype.cpp
tests/auto/qml/qml.pro
Change-Id: I78f992f83212bb9fd5e09b64163f15f046185224
Diffstat (limited to 'src/qmlmodels')
-rw-r--r-- | src/qmlmodels/qqmladaptormodel.cpp | 6 | ||||
-rw-r--r-- | src/qmlmodels/qqmldelegatemodel.cpp | 2 | ||||
-rw-r--r-- | src/qmlmodels/qqmllistaccessor.cpp | 4 | ||||
-rw-r--r-- | src/qmlmodels/qqmllistmodel.cpp | 26 |
4 files changed, 20 insertions, 18 deletions
diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp index cf0d8fbb2f..fbb85327a7 100644 --- a/src/qmlmodels/qqmladaptormodel.cpp +++ b/src/qmlmodels/qqmladaptormodel.cpp @@ -367,10 +367,10 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item); if (!modelData->cachedData.isEmpty()) { if (modelData->cachedData.count() > 1) { - modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QVariant::Invalid); + modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QMetaType::UnknownType); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, nullptr); } else if (modelData->cachedData.count() == 1) { - modelData->cachedData[0] = scope.engine->toVariant(argv[0], QVariant::Invalid); + modelData->cachedData[0] = scope.engine->toVariant(argv[0], QMetaType::UnknownType); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, nullptr); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, nullptr); } @@ -601,7 +601,7 @@ public: if (!argc) return v4->throwTypeError(); - static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(v4->toVariant(argv[0], QVariant::Invalid)); + static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(v4->toVariant(argv[0], QMetaType::UnknownType)); return QV4::Encode::undefined(); } diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index 7ad53eeb6c..3a3903965c 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -2011,7 +2011,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const propertyName = it.nextPropertyNameAsString(v); if (propertyName->isNull()) break; - cacheItem->setValue(propertyName->toQStringNoThrow(), scope.engine->toVariant(v, QVariant::Invalid)); + cacheItem->setValue(propertyName->toQStringNoThrow(), scope.engine->toVariant(v, QMetaType::UnknownType)); } cacheItem->groups = groups | Compositor::UnresolvedFlag | Compositor::CacheFlag; diff --git a/src/qmlmodels/qqmllistaccessor.cpp b/src/qmlmodels/qqmllistaccessor.cpp index 46a11e2bc2..c450c616e7 100644 --- a/src/qmlmodels/qqmllistaccessor.cpp +++ b/src/qmlmodels/qqmllistaccessor.cpp @@ -76,11 +76,11 @@ void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine) if (!d.isValid()) { m_type = Invalid; - } else if (d.userType() == QVariant::StringList) { + } else if (d.userType() == QMetaType::QStringList) { m_type = StringList; } else if (d.userType() == QMetaType::QVariantList) { m_type = VariantList; - } else if (d.canConvert(QVariant::Int)) { + } else if (d.canConvert(QMetaType::Int)) { // Here we have to check for an upper limit, because down the line code might (well, will) // allocate memory depending on the number of elements. The upper limit cannot be INT_MAX: // QVector<QPointer<QQuickItem>> something; diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index 1bbe9360bb..2c05b04429 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -219,14 +219,14 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV { Role::DataType type; - switch (data.type()) { - case QVariant::Double: type = Role::Number; break; - case QVariant::Int: type = Role::Number; break; - case QVariant::Bool: type = Role::Bool; break; - case QVariant::String: type = Role::String; break; - case QVariant::Map: type = Role::VariantMap; break; - case QVariant::DateTime: type = Role::DateTime; break; - case QVariant::UserType: { + switch (data.userType()) { + case QMetaType::Double: type = Role::Number; break; + case QMetaType::Int: type = Role::Number; break; + case QMetaType::Bool: type = Role::Bool; break; + case QMetaType::QString: type = Role::String; break; + case QMetaType::QVariantMap: type = Role::VariantMap; break; + case QMetaType::QDateTime: type = Role::DateTime; break; + default: { if (data.userType() == qMetaTypeId<QJSValue>() && data.value<QJSValue>().isCallable()) { type = Role::Function; @@ -235,12 +235,14 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV && data.value<const QV4::CompiledData::Binding*>()->isTranslationBinding()) { type = Role::String; break; - } else { + } else if (data.userType() >= QMetaType::User) { type = Role::List; break; + } else { + type = Role::Invalid; + break; } } - default: type = Role::Invalid; break; } if (type == Role::Invalid) { @@ -1722,7 +1724,7 @@ void DynamicRoleModelNode::updateValues(const QVariantMap &object, QVector<int> if (value.userType() == qMetaTypeId<QJSValue>()) value = value.value<QJSValue>().toVariant(); - if (value.type() == QVariant::List) { + if (value.userType() == QMetaType::QVariantList) { QQmlListModel *subModel = QQmlListModel::createWithOwner(m_owner); QVariantList subArray = value.toList(); @@ -1785,7 +1787,7 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) if (v.userType() == qMetaTypeId<QJSValue>()) v= v.value<QJSValue>().toVariant(); - if (v.type() == QVariant::List) { + if (v.userType() == QMetaType::QVariantList) { QQmlListModel *subModel = QQmlListModel::createWithOwner(parentModel); QVariantList subArray = v.toList(); |