diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index abe7445e398..4d127504d5d 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -54,67 +54,8 @@ static bool operator<(const QFileInfo &file1, const QFileInfo &file2) return file1.filePath() < file2.filePath(); } - QT_END_NAMESPACE - -static inline bool checkIfDerivedFromItem(const QString &fileName) -{ - return true; - - QmlJS::Snapshot snapshot; - - - QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); - if (modelManager) - snapshot = modelManager->snapshot(); - - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) - return false; - - QByteArray source = file.readAll(); - file.close(); - - QmlJS::Document::MutablePtr document = - QmlJS::Document::create(fileName.isEmpty() ? - QStringLiteral("") : fileName, QmlJS::Dialect::Qml); - document->setSource(QString::fromUtf8(source)); - document->parseQml(); - - - if (!document->isParsedCorrectly()) - return false; - - snapshot.insert(document); - - QmlJS::Link link(snapshot, modelManager->defaultVContext(document->language(), document), QmlJS::ModelManagerInterface::instance()->builtins(document)); - - QList diagnosticLinkMessages; - QmlJS::ContextPtr context = link(document, &diagnosticLinkMessages); - - QmlJS::AST::UiObjectMember *astRootNode = 0; - if (QmlJS::AST::UiProgram *program = document->qmlProgram()) - if (program->members) - astRootNode = program->members->member; - - QmlJS::AST::UiObjectDefinition *definition = QmlJS::AST::cast(astRootNode); - - if (!definition) - return false; - - const QmlJS::ObjectValue *objectValue = context->lookupType(document.data(), definition->qualifiedTypeNameId); - - QList prototypes = QmlJS::PrototypeIterator(objectValue, context).all(); - - foreach (const QmlJS::ObjectValue *prototype, prototypes) { - if (prototype->className() == QLatin1String("Item")) - return true; - } - - return false; -} - namespace QmlDesigner { static const QString s_qmlFilePattern = QStringLiteral("*.qml"); @@ -364,9 +305,6 @@ void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QStri if (!model()) return; - if (!checkIfDerivedFromItem(fileInfo.absoluteFilePath())) - return; - QString componentName = fileInfo.baseName(); const QString baseComponentName = componentName;