diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index c98ca0e6a53867600bd848d65b3398a5d736c755..a004804868cfe371a5c613cdb0e2ede2ee56c06d 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -367,11 +367,6 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo) m_treePos.append(0); m_currentItem = invisibleRootItem(); - // Set up lookup context once to do the element type lookup - // - // We're simplifying here by using the root context everywhere; should be - // ok since there is AFAIK no way to introduce new type names in a sub-context. - m_context = semanticInfo.lookupContext(); m_typeToIcon.clear(); m_itemToNode.clear(); m_itemToIdNode.clear(); @@ -381,8 +376,6 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo) QmlOutlineModelSync syncModel(this); syncModel(m_semanticInfo.document); - m_context.clear(); - emit updated(); } @@ -815,26 +808,18 @@ AST::SourceLocation QmlOutlineModel::getLocation(AST::ExpressionNode *exprNode) } QIcon QmlOutlineModel::getIcon(AST::UiQualifiedId *qualifiedId) { - const Interpreter::Value *value = m_context->evaluate(qualifiedId); - - if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) { - do { - QString module; - QString typeName; - if (const Interpreter::QmlObjectValue *qmlObjectValue = - dynamic_cast<const Interpreter::QmlObjectValue*>(objectValue)) { - module = qmlObjectValue->packageName(); - } - typeName = objectValue->className(); - - QIcon icon = m_icons->icon(module, typeName); - if (! icon.isNull()) - return icon; + QIcon icon; + if (qualifiedId) { + QString name = asString(qualifiedId); + if (name.contains(QLatin1Char('.'))) + name = name.split(QLatin1Char('.')).last(); - objectValue = objectValue->prototype(m_context->context()); - } while (objectValue); + // TODO: get rid of namespace prefixes. + icon = m_icons->icon("Qt", name); + if (icon.isNull()) + icon = m_icons->icon("QtWebkit", name); } - return QIcon(); + return icon; } QString QmlOutlineModel::getAnnotation(AST::UiObjectInitializer *objectInitializer) { diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h index 3717faa450b7584994e473dfcdb7f94ef842d13d..0da121abf226b2db92755ffc9d85f75ced36e3a9 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.h +++ b/src/plugins/qmljseditor/qmloutlinemodel.h @@ -120,7 +120,6 @@ private: QStandardItem *m_currentItem; QmlJS::Icons *m_icons; - QmlJS::LookupContext::Ptr m_context; QHash<QString, QIcon> m_typeToIcon; QHash<QmlOutlineItem*,QIcon> m_itemToIcon; QHash<QmlOutlineItem*,QmlJS::AST::Node*> m_itemToNode;