diff --git a/src/libs/qmljs/qmljscontext.cpp b/src/libs/qmljs/qmljscontext.cpp index c19cf11e92e..c52471d64d2 100644 --- a/src/libs/qmljs/qmljscontext.cpp +++ b/src/libs/qmljs/qmljscontext.cpp @@ -138,7 +138,7 @@ QString Context::defaultPropertyName(const ObjectValue *object) const QString defaultProperty = astObjValue->defaultPropertyName(); if (!defaultProperty.isEmpty()) return defaultProperty; - } else if (const QmlObjectValue *qmlValue = dynamic_cast(o)) { + } else if (const CppComponentValue *qmlValue = dynamic_cast(o)) { return qmlValue->defaultPropertyName(); } } diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index e062078b1ab..6679001d28d 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -159,7 +159,7 @@ public: } // end of anonymous namespace -QmlObjectValue::QmlObjectValue(FakeMetaObject::ConstPtr metaObject, const QString &className, +CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className, const QString &packageName, const ComponentVersion &componentVersion, const ComponentVersion &importVersion, int metaObjectRevision, ValueOwner *valueOwner) @@ -179,7 +179,7 @@ QmlObjectValue::QmlObjectValue(FakeMetaObject::ConstPtr metaObject, const QStrin } } -QmlObjectValue::~QmlObjectValue() +CppComponentValue::~CppComponentValue() { delete _metaSignatures; delete _signalScopes; @@ -193,7 +193,7 @@ static QString generatedSlotName(const QString &base) return slotName; } -void QmlObjectValue::processMembers(MemberProcessor *processor) const +void CppComponentValue::processMembers(MemberProcessor *processor) const { // process the meta enums for (int index = _metaObject->enumeratorOffset(); index < _metaObject->enumeratorCount(); ++index) { @@ -269,12 +269,12 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const ObjectValue::processMembers(processor); } -const Value *QmlObjectValue::valueForCppName(const QString &typeName) const +const Value *CppComponentValue::valueForCppName(const QString &typeName) const { const CppQmlTypes &cppTypes = valueOwner()->cppQmlTypes(); // check in the same package/version first - const QmlObjectValue *objectValue = cppTypes.objectByQualifiedName( + const CppComponentValue *objectValue = cppTypes.objectByQualifiedName( _moduleName, typeName, _importVersion); if (objectValue) return objectValue; @@ -322,7 +322,7 @@ const Value *QmlObjectValue::valueForCppName(const QString &typeName) const } // might be an enum - const QmlObjectValue *base = this; + const CppComponentValue *base = this; const QStringList components = typeName.split(QLatin1String("::")); if (components.size() == 2) { base = valueOwner()->cppQmlTypes().objectByCppName(components.first()); @@ -335,42 +335,42 @@ const Value *QmlObjectValue::valueForCppName(const QString &typeName) const return valueOwner()->undefinedValue(); } -const QmlObjectValue *QmlObjectValue::prototype() const +const CppComponentValue *CppComponentValue::prototype() const { - Q_ASSERT(!_prototype || dynamic_cast(_prototype)); - return static_cast(_prototype); + Q_ASSERT(!_prototype || dynamic_cast(_prototype)); + return static_cast(_prototype); } -const QmlObjectValue *QmlObjectValue::attachedType() const +const CppComponentValue *CppComponentValue::attachedType() const { return _attachedType; } -void QmlObjectValue::setAttachedType(QmlObjectValue *value) +void CppComponentValue::setAttachedType(CppComponentValue *value) { _attachedType = value; } -FakeMetaObject::ConstPtr QmlObjectValue::metaObject() const +FakeMetaObject::ConstPtr CppComponentValue::metaObject() const { return _metaObject; } -QString QmlObjectValue::moduleName() const +QString CppComponentValue::moduleName() const { return _moduleName; } -ComponentVersion QmlObjectValue::componentVersion() const +ComponentVersion CppComponentValue::componentVersion() const { return _componentVersion; } -ComponentVersion QmlObjectValue::importVersion() const +ComponentVersion CppComponentValue::importVersion() const { return _importVersion; } -QString QmlObjectValue::defaultPropertyName() const +QString CppComponentValue::defaultPropertyName() const { return _metaObject->defaultPropertyName(); } -QString QmlObjectValue::propertyType(const QString &propertyName) const +QString CppComponentValue::propertyType(const QString &propertyName) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -380,9 +380,9 @@ QString QmlObjectValue::propertyType(const QString &propertyName) const return QString(); } -bool QmlObjectValue::isListProperty(const QString &propertyName) const +bool CppComponentValue::isListProperty(const QString &propertyName) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -392,9 +392,9 @@ bool QmlObjectValue::isListProperty(const QString &propertyName) const return false; } -FakeMetaEnum QmlObjectValue::getEnum(const QString &typeName, const QmlObjectValue **foundInScope) const +FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppComponentValue **foundInScope) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; const int index = iter->enumeratorIndex(typeName); if (index != -1) { @@ -408,9 +408,9 @@ FakeMetaEnum QmlObjectValue::getEnum(const QString &typeName, const QmlObjectVal return FakeMetaEnum(); } -const QmlEnumValue *QmlObjectValue::getEnumValue(const QString &typeName, const QmlObjectValue **foundInScope) const +const QmlEnumValue *CppComponentValue::getEnumValue(const QString &typeName, const CppComponentValue **foundInScope) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { if (const QmlEnumValue *e = it->_enums.value(typeName)) { if (foundInScope) *foundInScope = it; @@ -422,7 +422,7 @@ const QmlEnumValue *QmlObjectValue::getEnumValue(const QString &typeName, const return 0; } -const ObjectValue *QmlObjectValue::signalScope(const QString &signalName) const +const ObjectValue *CppComponentValue::signalScope(const QString &signalName) const { QHash *scopes = _signalScopes; if (!scopes) { @@ -457,9 +457,9 @@ const ObjectValue *QmlObjectValue::signalScope(const QString &signalName) const return scopes->value(signalName); } -bool QmlObjectValue::isWritable(const QString &propertyName) const +bool CppComponentValue::isWritable(const QString &propertyName) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -469,9 +469,9 @@ bool QmlObjectValue::isWritable(const QString &propertyName) const return false; } -bool QmlObjectValue::isPointer(const QString &propertyName) const +bool CppComponentValue::isPointer(const QString &propertyName) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -481,7 +481,7 @@ bool QmlObjectValue::isPointer(const QString &propertyName) const return false; } -bool QmlObjectValue::hasLocalProperty(const QString &typeName) const +bool CppComponentValue::hasLocalProperty(const QString &typeName) const { int idx = _metaObject->propertyIndex(typeName); if (idx == -1) @@ -489,9 +489,9 @@ bool QmlObjectValue::hasLocalProperty(const QString &typeName) const return true; } -bool QmlObjectValue::hasProperty(const QString &propertyName) const +bool CppComponentValue::hasProperty(const QString &propertyName) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -501,9 +501,9 @@ bool QmlObjectValue::hasProperty(const QString &propertyName) const return false; } -bool QmlObjectValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const +bool CppComponentValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const { - for (const QmlObjectValue *it = this; it; it = it->prototype()) { + for (const CppComponentValue *it = this; it; it = it->prototype()) { FakeMetaObject::ConstPtr iter = it->_metaObject; if (iter == base) return true; @@ -511,7 +511,7 @@ bool QmlObjectValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const return false; } -QmlEnumValue::QmlEnumValue(const QmlObjectValue *owner, int enumIndex) +QmlEnumValue::QmlEnumValue(const CppComponentValue *owner, int enumIndex) : _owner(owner) , _enumIndex(enumIndex) { @@ -532,7 +532,7 @@ QStringList QmlEnumValue::keys() const return _owner->metaObject()->enumerator(_enumIndex).keys(); } -const QmlObjectValue *QmlEnumValue::owner() const +const CppComponentValue *QmlEnumValue::owner() const { return _owner; } @@ -1290,7 +1290,7 @@ const QLatin1String CppQmlTypes::cppPackage(""); template void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) { - QList newCppTypes; + QList newCppTypes; foreach (const FakeMetaObject::ConstPtr &fmo, fakeMetaObjects) { foreach (const FakeMetaObject::Export &exp, fmo->exports()) { QString package = exp.package; @@ -1303,7 +1303,7 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) if (exp.package == cppPackage) { QTC_ASSERT(exp.version == ComponentVersion(), continue); QTC_ASSERT(exp.type == fmo->className(), continue); - QmlObjectValue *cppValue = new QmlObjectValue( + CppComponentValue *cppValue = new CppComponentValue( fmo, fmo->className(), cppPackage, ComponentVersion(), ComponentVersion(), ComponentVersion::MaxVersion, _valueOwner); _objectsByQualifiedName[qualifiedName(cppPackage, fmo->className(), ComponentVersion())] = cppValue; @@ -1313,9 +1313,9 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) } // set prototypes of cpp types - foreach (QmlObjectValue *object, newCppTypes) { + foreach (CppComponentValue *object, newCppTypes) { const QString &protoCppName = object->metaObject()->superclassName(); - const QmlObjectValue *proto = objectByCppName(protoCppName); + const CppComponentValue *proto = objectByCppName(protoCppName); if (proto) object->setPrototype(proto); } @@ -1324,10 +1324,10 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) template void CppQmlTypes::load< QList >(const QList &, const QString &); template void CppQmlTypes::load< QHash >(const QHash &, const QString &); -QList CppQmlTypes::createObjectsForImport(const QString &package, ComponentVersion version) +QList CppQmlTypes::createObjectsForImport(const QString &package, ComponentVersion version) { - QList exportedObjects; - QList newObjects; + QList exportedObjects; + QList newObjects; // make new exported objects foreach (const FakeMetaObject::ConstPtr &fmo, _fakeMetaObjectsByPackage.value(package)) { @@ -1354,7 +1354,7 @@ QList CppQmlTypes::createObjectsForImport(const QString name = fmo->className(); } - QmlObjectValue *newObject = new QmlObjectValue( + CppComponentValue *newObject = new CppComponentValue( fmo, name, package, bestExport.version, version, bestExport.metaObjectRevision, _valueOwner); @@ -1366,8 +1366,8 @@ QList CppQmlTypes::createObjectsForImport(const QString } // set their prototypes, creating them if necessary - foreach (const QmlObjectValue *cobject, newObjects) { - QmlObjectValue *object = const_cast(cobject); + foreach (const CppComponentValue *cobject, newObjects) { + CppComponentValue *object = const_cast(cobject); while (!object->prototype()) { const QString &protoCppName = object->metaObject()->superclassName(); if (protoCppName.isEmpty()) @@ -1375,19 +1375,19 @@ QList CppQmlTypes::createObjectsForImport(const QString // if the prototype already exists, done const QString key = qualifiedName(object->moduleName(), protoCppName, version); - if (const QmlObjectValue *proto = _objectsByQualifiedName.value(key)) { + if (const CppComponentValue *proto = _objectsByQualifiedName.value(key)) { object->setPrototype(proto); break; } // get the fmo via the cpp name - const QmlObjectValue *cppProto = objectByCppName(protoCppName); + const CppComponentValue *cppProto = objectByCppName(protoCppName); if (!cppProto) break; FakeMetaObject::ConstPtr protoFmo = cppProto->metaObject(); // make a new object - QmlObjectValue *proto = new QmlObjectValue( + CppComponentValue *proto = new CppComponentValue( protoFmo, protoCppName, object->moduleName(), ComponentVersion(), object->importVersion(), ComponentVersion::MaxVersion, _valueOwner); _objectsByQualifiedName.insert(key, proto); @@ -1414,18 +1414,18 @@ QString CppQmlTypes::qualifiedName(const QString &module, const QString &type, C } -const QmlObjectValue *CppQmlTypes::objectByQualifiedName(const QString &name) const +const CppComponentValue *CppQmlTypes::objectByQualifiedName(const QString &name) const { return _objectsByQualifiedName.value(name); } -const QmlObjectValue *CppQmlTypes::objectByQualifiedName(const QString &package, const QString &type, +const CppComponentValue *CppQmlTypes::objectByQualifiedName(const QString &package, const QString &type, ComponentVersion version) const { return objectByQualifiedName(qualifiedName(package, type, version)); } -const QmlObjectValue *CppQmlTypes::objectByCppName(const QString &cppName) const +const CppComponentValue *CppQmlTypes::objectByCppName(const QString &cppName) const { return objectByQualifiedName(qualifiedName(cppPackage, cppName, ComponentVersion())); } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 56268a127f2..513fe6b045f 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -394,43 +394,43 @@ private: Error m_error; }; -class QmlObjectValue; +class CppComponentValue; class QMLJS_EXPORT QmlEnumValue: public NumberValue { public: - QmlEnumValue(const QmlObjectValue *owner, int index); + QmlEnumValue(const CppComponentValue *owner, int index); virtual ~QmlEnumValue(); QString name() const; QStringList keys() const; - const QmlObjectValue *owner() const; + const CppComponentValue *owner() const; private: - const QmlObjectValue *_owner; + const CppComponentValue *_owner; int _enumIndex; }; // A ObjectValue based on a FakeMetaObject. -// May only have other QmlObjectValues as ancestors. -class QMLJS_EXPORT QmlObjectValue: public ObjectValue +// May only have other CppComponentValue as ancestors. +class QMLJS_EXPORT CppComponentValue: public ObjectValue { public: - QmlObjectValue(LanguageUtils::FakeMetaObject::ConstPtr metaObject, const QString &className, + CppComponentValue(LanguageUtils::FakeMetaObject::ConstPtr metaObject, const QString &className, const QString &moduleName, const LanguageUtils::ComponentVersion &componentVersion, const LanguageUtils::ComponentVersion &importVersion, int metaObjectRevision, ValueOwner *valueOwner); - virtual ~QmlObjectValue(); + virtual ~CppComponentValue(); virtual void processMembers(MemberProcessor *processor) const; const Value *valueForCppName(const QString &typeName) const; using ObjectValue::prototype; - const QmlObjectValue *prototype() const; + const CppComponentValue *prototype() const; - const QmlObjectValue *attachedType() const; - void setAttachedType(QmlObjectValue *value); + const CppComponentValue *attachedType() const; + void setAttachedType(CppComponentValue *value); LanguageUtils::FakeMetaObject::ConstPtr metaObject() const; @@ -446,15 +446,15 @@ public: bool hasLocalProperty(const QString &typeName) const; bool hasProperty(const QString &typeName) const; - LanguageUtils::FakeMetaEnum getEnum(const QString &typeName, const QmlObjectValue **foundInScope = 0) const; - const QmlEnumValue *getEnumValue(const QString &typeName, const QmlObjectValue **foundInScope = 0) const; + LanguageUtils::FakeMetaEnum getEnum(const QString &typeName, const CppComponentValue **foundInScope = 0) const; + const QmlEnumValue *getEnumValue(const QString &typeName, const CppComponentValue **foundInScope = 0) const; const ObjectValue *signalScope(const QString &signalName) const; protected: bool isDerivedFrom(LanguageUtils::FakeMetaObject::ConstPtr base) const; private: - QmlObjectValue *_attachedType; + CppComponentValue *_attachedType; LanguageUtils::FakeMetaObject::ConstPtr _metaObject; const QString _moduleName; // _componentVersion is the version of the export @@ -588,20 +588,20 @@ public: template void load(const T &fakeMetaObjects, const QString &overridePackage = QString()); - QList createObjectsForImport(const QString &package, LanguageUtils::ComponentVersion version); + QList createObjectsForImport(const QString &package, LanguageUtils::ComponentVersion version); bool hasModule(const QString &module) const; static QString qualifiedName(const QString &module, const QString &type, LanguageUtils::ComponentVersion version); - const QmlObjectValue *objectByQualifiedName(const QString &fullyQualifiedName) const; - const QmlObjectValue *objectByQualifiedName( + const CppComponentValue *objectByQualifiedName(const QString &fullyQualifiedName) const; + const CppComponentValue *objectByQualifiedName( const QString &package, const QString &type, LanguageUtils::ComponentVersion version) const; - const QmlObjectValue *objectByCppName(const QString &cppName) const; + const CppComponentValue *objectByCppName(const QString &cppName) const; private: - // "Package.CppName ImportVersion" -> QmlObjectValue - QHash _objectsByQualifiedName; + // "Package.CppName ImportVersion" -> CppComponentValue + QHash _objectsByQualifiedName; QHash > _fakeMetaObjectsByPackage; ValueOwner *_valueOwner; }; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index d3e553bbc73..7d693ec0c7e 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -366,7 +366,7 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf // if there are cpp-based types for this package, use them too if (valueOwner->cppQmlTypes().hasModule(packageName)) { importFound = true; - foreach (const QmlObjectValue *object, + foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) { import.object->setMember(object->className(), object); } @@ -439,7 +439,7 @@ bool LinkPrivate::importLibrary(Document::Ptr doc, } else { const QString packageName = importInfo.name(); valueOwner->cppQmlTypes().load(libraryInfo.metaObjects(), packageName); - foreach (const QmlObjectValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) { + foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) { import->object->setMember(object->className(), object); } } @@ -522,7 +522,7 @@ void LinkPrivate::loadImplicitDefaultImports(Imports *imports) import.valid = true; import.info = info; import.object = new ObjectValue(valueOwner); - foreach (const QmlObjectValue *object, + foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport( defaultPackage, maxVersion)) { import.object->setMember(object->className(), object); diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index fd72b565338..e89deb53af4 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -185,7 +185,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node) iter.next(); while (iter.hasNext()) { const ObjectValue *prototype = iter.next(); - if (const QmlObjectValue *qmlMetaObject = dynamic_cast(prototype)) { + if (const CppComponentValue *qmlMetaObject = dynamic_cast(prototype)) { if ((qmlMetaObject->className() == QLatin1String("ListElement") || qmlMetaObject->className() == QLatin1String("Connections") ) && (qmlMetaObject->moduleName() == QLatin1String("Qt") @@ -259,7 +259,7 @@ const ObjectValue *ScopeBuilder::isPropertyChangesObject(const ContextPtr &conte PrototypeIterator iter(object, context); while (iter.hasNext()) { const ObjectValue *prototype = iter.next(); - if (const QmlObjectValue *qmlMetaObject = dynamic_cast(prototype)) { + if (const CppComponentValue *qmlMetaObject = dynamic_cast(prototype)) { if (qmlMetaObject->className() == QLatin1String("PropertyChanges") && (qmlMetaObject->moduleName() == QLatin1String("Qt") || qmlMetaObject->moduleName() == QLatin1String("QtQuick"))) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 388de0c9b72..93d65369334 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -103,7 +103,7 @@ public: type = ref->ast()->memberType.toString(); m_properties.append(qMakePair(name, type)); } else { - if (const QmlObjectValue * ov = dynamic_cast(value)) { + if (const CppComponentValue * ov = dynamic_cast(value)) { QString qualifiedTypeName = ov->moduleName().isEmpty() ? ov->className() : ov->moduleName() + '.' + ov->className(); m_properties.append(qMakePair(name, qualifiedTypeName)); } else { @@ -135,12 +135,12 @@ static inline bool isValueType(const QString &type) return objectValuesList.contains(type); } -const QmlObjectValue *findQmlPrototype(const ObjectValue *ov, const ContextPtr &context) +const CppComponentValue *findQmlPrototype(const ObjectValue *ov, const ContextPtr &context) { if (!ov) return 0; - const QmlObjectValue * qmlValue = dynamic_cast(ov); + const CppComponentValue * qmlValue = dynamic_cast(ov); if (qmlValue) return qmlValue; @@ -154,7 +154,7 @@ QStringList prototypes(const ObjectValue *ov, const ContextPtr &context, bool ve return list; ov = ov->prototype(context); while (ov) { - const QmlObjectValue * qmlValue = dynamic_cast(ov); + const CppComponentValue * qmlValue = dynamic_cast(ov); if (qmlValue) { if (versions) { list << qmlValue->moduleName() + '.' + qmlValue->className() + @@ -177,7 +177,7 @@ QStringList prototypes(const ObjectValue *ov, const ContextPtr &context, bool ve QList getObjectTypes(const ObjectValue *ov, const ContextPtr &context, bool local = false); -QList getQmlTypes(const QmlObjectValue *ov, const ContextPtr &context, bool local = false) +QList getQmlTypes(const CppComponentValue *ov, const ContextPtr &context, bool local = false) { QList list; if (!ov) @@ -192,7 +192,7 @@ QList getQmlTypes(const QmlObjectValue *ov, const ContextPtr &cont QString name = property.first; if (!ov->isWritable(name) && ov->isPointer(name)) { //dot property - const QmlObjectValue * qmlValue = dynamic_cast(ov->lookupMember(name, context)); + const CppComponentValue * qmlValue = dynamic_cast(ov->lookupMember(name, context)); if (qmlValue) { QList dotProperties = getQmlTypes(qmlValue, context); foreach (const PropertyInfo &propertyInfo, dotProperties) { @@ -224,7 +224,7 @@ QList getQmlTypes(const QmlObjectValue *ov, const ContextPtr &cont if (!local) { const ObjectValue* prototype = ov->prototype(context); - const QmlObjectValue * qmlObjectValue = dynamic_cast(prototype); + const CppComponentValue * qmlObjectValue = dynamic_cast(prototype); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context); @@ -240,7 +240,7 @@ QList getTypes(const ObjectValue *ov, const ContextPtr &context, b { QList list; - const QmlObjectValue * qmlObjectValue = dynamic_cast(ov); + const CppComponentValue * qmlObjectValue = dynamic_cast(ov); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context, local); @@ -264,7 +264,7 @@ QList getObjectTypes(const ObjectValue *ov, const ContextPtr &cont if (!local) { const ObjectValue* prototype = ov->prototype(context); - const QmlObjectValue * qmlObjectValue = dynamic_cast(prototype); + const CppComponentValue * qmlObjectValue = dynamic_cast(prototype); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context); @@ -358,13 +358,13 @@ public: private: NodeMetaInfoPrivate(Model *model, QString type, int maj = -1, int min = -1); - const QmlJS::QmlObjectValue *getQmlObjectValue() const; + const QmlJS::CppComponentValue *getCppComponentValue() const; const QmlJS::ObjectValue *getObjectValue() const; void setupPropertyInfo(QList propertyInfos); void setupLocalPropertyInfo(QList propertyInfos); QString lookupName() const; QStringList lookupNameComponent() const; - const QmlJS::QmlObjectValue *getNearestQmlObjectValue() const; + const QmlJS::CppComponentValue *getNearestCppComponentValue() const; QString fullQualifiedImportAliasType() const; QString m_qualfiedTypeName; @@ -424,7 +424,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in m_model(model) { if (context()) { - const QmlObjectValue *objectValue = getQmlObjectValue(); + const CppComponentValue *objectValue = getCppComponentValue(); if (objectValue) { setupPropertyInfo(getTypes(objectValue, context())); setupLocalPropertyInfo(getTypes(objectValue, context(), true)); @@ -434,7 +434,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in } else { const ObjectValue *objectValue = getObjectValue(); if (objectValue) { - const QmlObjectValue *qmlValue = dynamic_cast(objectValue); + const CppComponentValue *qmlValue = dynamic_cast(objectValue); if (qmlValue) { m_majorVersion = qmlValue->componentVersion().majorVersion(); m_minorVersion = qmlValue->componentVersion().minorVersion(); @@ -452,7 +452,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in } } -const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue() const +const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() const { const QStringList nameComponents = m_qualfiedTypeName.split('.'); if (nameComponents.size() < 2) @@ -460,7 +460,7 @@ const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue() const const QString type = nameComponents.last(); // maybe 'type' is a cpp name - const QmlJS::QmlObjectValue *value = context()->valueOwner()->cppQmlTypes().objectByCppName(type); + const QmlJS::CppComponentValue *value = context()->valueOwner()->cppQmlTypes().objectByCppName(type); if (value) return value; @@ -476,7 +476,7 @@ const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue() const if (import.info.path() != module) continue; const Value *lookupResult = import.object->lookupMember(type, context()); - if ((value = dynamic_cast(lookupResult))) + if ((value = dynamic_cast(lookupResult))) return value; } @@ -541,7 +541,7 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const QString &propertyName) const return true; } - const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return true; if (qmlObjectValue->hasProperty(propertyName)) @@ -573,7 +573,7 @@ bool NodeMetaInfoPrivate::isPropertyList(const QString &propertyName) const return true; } - const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isListProperty(propertyName); @@ -601,7 +601,7 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const QString &propertyName) const return true; } - const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isPointer(propertyName); @@ -629,7 +629,7 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const QString &propertyName) const return false; } - const QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; return qmlObjectValue->getEnum(propertyType(propertyName)).isValid(); @@ -657,10 +657,10 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const QString &propertyName) cons return QString(); } - const QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return QString(); - const QmlObjectValue *definedIn = 0; + const CppComponentValue *definedIn = 0; qmlObjectValue->getEnum(propertyType(propertyName), &definedIn); if (definedIn) return definedIn->className(); @@ -686,7 +686,7 @@ bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const if (packageName() == package) return QString(package + '.' + typeName) == qualfiedTypeName(); - const QmlObjectValue *qmlObjectValue = getQmlObjectValue(); + const CppComponentValue *qmlObjectValue = getCppComponentValue(); if (!qmlObjectValue) return false; @@ -741,7 +741,7 @@ QStringList NodeMetaInfoPrivate::keysForEnum(const QString &enumName) const if (!isValid()) return QStringList(); - const QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return QStringList(); return qmlObjectValue->getEnum(enumName).keys(); @@ -750,7 +750,7 @@ QStringList NodeMetaInfoPrivate::keysForEnum(const QString &enumName) const QString NodeMetaInfoPrivate::packageName() const { if (!isComponent()) { - if (const QmlObjectValue *qmlObject = getQmlObjectValue()) + if (const CppComponentValue *qmlObject = getCppComponentValue()) return qmlObject->moduleName(); } return QString(); @@ -825,13 +825,13 @@ void NodeMetaInfoPrivate::setupPrototypes() if (m_isComponent) objects = PrototypeIterator(getObjectValue(), context()).all(); else - objects = PrototypeIterator(getQmlObjectValue(), context()).all(); + objects = PrototypeIterator(getCppComponentValue(), context()).all(); foreach (const ObjectValue *ov, objects) { TypeDescription description; description.className = ov->className(); description.minorVersion = -1; description.majorVersion = -1; - if (const QmlObjectValue * qmlValue = dynamic_cast(ov)) { + if (const CppComponentValue * qmlValue = dynamic_cast(ov)) { description.minorVersion = qmlValue->componentVersion().minorVersion(); description.majorVersion = qmlValue->componentVersion().majorVersion(); if (!qmlValue->moduleName().isEmpty()) @@ -850,11 +850,11 @@ QList NodeMetaInfoPrivate::prototypes() const return m_prototypes; } -const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getNearestQmlObjectValue() const +const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getNearestCppComponentValue() const { if (m_isComponent) return findQmlPrototype(getObjectValue(), context()); - return getQmlObjectValue(); + return getCppComponentValue(); } QString NodeMetaInfoPrivate::fullQualifiedImportAliasType() const diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 607dcfce862..be9b9f01531 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -344,7 +344,7 @@ public: const ObjectValue *value = m_context->lookupType(m_doc.data(), astTypeNode); defaultPropertyName = m_context->defaultPropertyName(value); - const QmlObjectValue * qmlValue = dynamic_cast(value); + const CppComponentValue * qmlValue = dynamic_cast(value); if (qmlValue) { typeName = fixUpPackeNameForQt(qmlValue->moduleName()) + QLatin1String(".") + qmlValue->className(); @@ -500,7 +500,7 @@ public: const ObjectValue *proto = iter.next(); if (proto->lookupMember(name, m_context) == m_context->valueOwner()->arrayPrototype()) return true; - if (const QmlObjectValue *qmlIter = dynamic_cast(proto)) { + if (const CppComponentValue *qmlIter = dynamic_cast(proto)) { if (qmlIter->isListProperty(name)) return true; } @@ -525,7 +525,7 @@ public: if (containingObject) containingObject->lookupMember(name, m_context, &containingObject); - if (const QmlObjectValue * qmlObject = dynamic_cast(containingObject)) { + if (const CppComponentValue * qmlObject = dynamic_cast(containingObject)) { const QString typeName = qmlObject->propertyType(name); if (qmlObject->getEnum(typeName).isValid()) { return QVariant(cleanedValue); @@ -569,10 +569,10 @@ public: if (containingObject) containingObject->lookupMember(name, m_context, &containingObject); - const QmlObjectValue * lhsQmlObject = dynamic_cast(containingObject); - if (!lhsQmlObject) + const CppComponentValue * lhsCppComponent = dynamic_cast(containingObject); + if (!lhsCppComponent) return QVariant(); - const QString lhsPropertyTypeName = lhsQmlObject->propertyType(name); + const QString lhsPropertyTypeName = lhsCppComponent->propertyType(name); const ObjectValue *rhsValueObject = 0; QString rhsValueName; @@ -593,11 +593,11 @@ public: if (rhsValueObject) rhsValueObject->lookupMember(rhsValueName, m_context, &rhsValueObject); - const QmlObjectValue *rhsQmlObjectValue = dynamic_cast(rhsValueObject); - if (!rhsQmlObjectValue) + const CppComponentValue *rhsCppComponentValue = dynamic_cast(rhsValueObject); + if (!rhsCppComponentValue) return QVariant(); - if (rhsQmlObjectValue->getEnum(lhsPropertyTypeName).hasKey(rhsValueName)) + if (rhsCppComponentValue->getEnum(lhsPropertyTypeName).hasKey(rhsValueName)) return QVariant(rhsValueName); else return QVariant(); diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index eae0794e784..b5b0dd75775 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -148,7 +148,7 @@ public: virtual void operator ()(const Value *base, const QString &name, const Value *) { - const QmlObjectValue *qmlBase = dynamic_cast(base); + const CppComponentValue *qmlBase = dynamic_cast(base); QString itemText = name; QString postfix; diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index b9002403f4c..b22db9abca0 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -94,7 +94,7 @@ class CollectStateNames : protected Visitor QStringList m_stateNames; bool m_inStateType; ScopeChain m_scopeChain; - const QmlObjectValue *m_statePrototype; + const CppComponentValue *m_statePrototype; public: CollectStateNames(const ScopeChain &scopeChain) @@ -138,7 +138,7 @@ protected: PrototypeIterator it(v, m_scopeChain.context()); while (it.hasNext()) { const ObjectValue *proto = it.next(); - const QmlObjectValue *qmlProto = dynamic_cast(proto); + const CppComponentValue *qmlProto = dynamic_cast(proto); if (!qmlProto) continue; if (qmlProto->metaObject() == m_statePrototype->metaObject()) diff --git a/tests/auto/qml/codemodel/basic/tst_basic.cpp b/tests/auto/qml/codemodel/basic/tst_basic.cpp index 1ea23545ca8..d5640eb0860 100644 --- a/tests/auto/qml/codemodel/basic/tst_basic.cpp +++ b/tests/auto/qml/codemodel/basic/tst_basic.cpp @@ -124,8 +124,8 @@ void tst_Basic::basicObjectTests() ContextPtr context = Link(snapshot, QStringList(), LibraryInfo())(); QVERIFY(context); - QmlObjectValue *rectangleValue = context->valueOwner()->cppQmlTypes().typeByQualifiedName( - "Qt", "Rectangle", LanguageUtils::ComponentVersion(4, 7)); + const CppComponentValue *rectangleValue = context->valueOwner()->cppQmlTypes().objectByQualifiedName( + "QtQuick", "QDeclarative1Rectangle", LanguageUtils::ComponentVersion(1, 0)); QVERIFY(rectangleValue); QVERIFY(!rectangleValue->isWritable("border")); QVERIFY(rectangleValue->hasProperty("border")); @@ -135,7 +135,7 @@ void tst_Basic::basicObjectTests() const ObjectValue *ovItem = context->lookupType(doc.data(), QStringList() << "Item"); QCOMPARE(ovItem->className(), QString("Item")); - QCOMPARE(context->imports(doc.data())->info("Item", context.data()).name(), QString("Qt")); + QCOMPARE(context->imports(doc.data())->info("Item", context.data()).name(), QString("QtQuick")); const ObjectValue *ovButton = context->lookupType(doc.data(), QStringList() << "MyButton"); QCOMPARE(ovButton->className(), QString("MyButton")); QCOMPARE(ovButton->prototype(context)->className(), QString("Rectangle")); @@ -144,17 +144,17 @@ void tst_Basic::basicObjectTests() QVERIFY(ovProperty); QCOMPARE(ovProperty->className(), QString("State")); - const QmlObjectValue * qmlItemValue = dynamic_cast(ovItem); + const CppComponentValue * qmlItemValue = dynamic_cast(ovItem); QVERIFY(qmlItemValue); QCOMPARE(qmlItemValue->defaultPropertyName(), QString("data")); QCOMPARE(qmlItemValue->propertyType("state"), QString("string")); const ObjectValue *ovState = context->lookupType(doc.data(), QStringList() << "State"); - const QmlObjectValue * qmlState2Value = dynamic_cast(ovState); + const CppComponentValue * qmlState2Value = dynamic_cast(ovState); QCOMPARE(qmlState2Value->className(), QString("State")); const ObjectValue *ovImage = context->lookupType(doc.data(), QStringList() << "Image"); - const QmlObjectValue * qmlImageValue = dynamic_cast(ovImage); + const CppComponentValue * qmlImageValue = dynamic_cast(ovImage); QCOMPARE(qmlImageValue->className(), QString("Image")); QCOMPARE(qmlImageValue->propertyType("source"), QString("QUrl")); }