diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-04 13:49:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-05 16:31:09 +0200 |
commit | 4ec66f1c4aa96ef919a0b902dd460f450170ce1b (patch) | |
tree | dcc992736014232e946d4eb427ba82a2206cc77b /src/qml/qml/qqmlpropertycachecreator.cpp | |
parent | da7547080b83b4d2f2b6eb12e92afa3ff60ee295 (diff) |
Clean up property type to meta-type mapping
Centralize the mapping in one place using a helper function. This
eliminates the table where the first field was unused as well.
Change-Id: I78b599d255e37931a02a8294b1df3d44023c9a15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycachecreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertycachecreator.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlpropertycachecreator.cpp b/src/qml/qml/qqmlpropertycachecreator.cpp index bd4f2a0612..822241d58c 100644 --- a/src/qml/qml/qqmlpropertycachecreator.cpp +++ b/src/qml/qml/qqmlpropertycachecreator.cpp @@ -45,6 +45,36 @@ QT_BEGIN_NAMESPACE QAtomicInt QQmlPropertyCacheCreatorBase::classIndexCounter(0); + +int QQmlPropertyCacheCreatorBase::metaTypeForPropertyType(QV4::CompiledData::Property::Type type) +{ + switch (type) { + case QV4::CompiledData::Property::Var: return QMetaType::QVariant; + case QV4::CompiledData::Property::Variant: return QMetaType::QVariant; + case QV4::CompiledData::Property::Int: return QMetaType::Int; + case QV4::CompiledData::Property::Bool: return QMetaType::Bool; + case QV4::CompiledData::Property::Real: return QMetaType::Double; + case QV4::CompiledData::Property::String: return QMetaType::QString; + case QV4::CompiledData::Property::Url: return QMetaType::QUrl; + case QV4::CompiledData::Property::Color: return QMetaType::QColor; + case QV4::CompiledData::Property::Font: return QMetaType::QFont; + case QV4::CompiledData::Property::Time: return QMetaType::QTime; + case QV4::CompiledData::Property::Date: return QMetaType::QDate; + case QV4::CompiledData::Property::DateTime: return QMetaType::QDateTime; + case QV4::CompiledData::Property::Rect: return QMetaType::QRectF; + case QV4::CompiledData::Property::Point: return QMetaType::QPointF; + case QV4::CompiledData::Property::Size: return QMetaType::QSizeF; + case QV4::CompiledData::Property::Vector2D: return QMetaType::QVector2D; + case QV4::CompiledData::Property::Vector3D: return QMetaType::QVector3D; + case QV4::CompiledData::Property::Vector4D: return QMetaType::QVector4D; + case QV4::CompiledData::Property::Matrix4x4: return QMetaType::QMatrix4x4; + case QV4::CompiledData::Property::Quaternion: return QMetaType::QQuaternion; + case QV4::CompiledData::Property::Custom: break; + case QV4::CompiledData::Property::CustomList: break; + }; + return QMetaType::UnknownType; +} + QQmlBindingInstantiationContext::QQmlBindingInstantiationContext(int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding, const QString &instantiatingPropertyName, QQmlPropertyCache *referencingObjectPropertyCache) : referencingObjectIndex(referencingObjectIndex) |