diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 80a4d43bc97..9d5b523bdf0 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -193,7 +193,12 @@ bool Bind::visit(UiImport *ast) } } - namespaceObject->setProperty(userComponent->componentName(), objectValue); + const QString componentName = userComponent->componentName(); + + if (! componentName.isEmpty()) { + objectValue->setClassName(componentName); + namespaceObject->setProperty(componentName, objectValue); + } } } } diff --git a/src/plugins/qmljseditor/qmlhoverhandler.cpp b/src/plugins/qmljseditor/qmlhoverhandler.cpp index 9aace5d309d..eb874a04399 100644 --- a/src/plugins/qmljseditor/qmlhoverhandler.cpp +++ b/src/plugins/qmljseditor/qmlhoverhandler.cpp @@ -146,6 +146,11 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in if (qmlDocument.isNull()) return; + if (m_helpEngineNeedsSetup && m_helpEngine->registeredDocumentations().count() > 0) { + m_helpEngine->setupData(); + m_helpEngineNeedsSetup = false; + } + QTextCursor tc(edit->document()); tc.setPosition(pos); @@ -165,7 +170,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in bool stop = false; while (!stop) { const QChar ch = editor->characterAt(tc.position()); - if (ch.isLetterOrNumber() || ch == QLatin1Char('_') || ch == QLatin1Char('.')) { + if (ch.isLetterOrNumber() || ch == QLatin1Char('_')) { tc.setPosition(tc.position() + 1); } else { stop = true; @@ -189,61 +194,60 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in Interpreter::ObjectValue *scope = bind(declaringMember); Check check(&interp); const Interpreter::Value *value = check(expression, scope); - m_toolTip = prettyPrint(value, &interp); + QStringList baseClasses; + m_toolTip = prettyPrint(value, &interp, &baseClasses); + foreach (const QString &baseClass, baseClasses) { + QString helpId = QLatin1String("QML."); + helpId += baseClass; -#if 0 - QmlLookupContext context(expressionUnderCursor.expressionScopes(), doc, m_modelManager->snapshot(), typeSystem); - QmlResolveExpression resolver(context); - Symbol *resolvedSymbol = resolver.typeOf(expressionUnderCursor.expressionNode()); - - if (resolvedSymbol) { - symbolName = resolvedSymbol->name(); - - if (resolvedSymbol->isBuildInSymbol()) - m_helpId = buildHelpId(resolvedSymbol); - else if (SymbolFromFile *symbolFromFile = resolvedSymbol->asSymbolFromFile()) - m_toolTip = symbolFromFile->fileName(); + if (! m_helpEngine->linksForIdentifier(helpId).isEmpty()) { + m_helpId = helpId; + break; + } } -#endif - } - - if (m_helpEngineNeedsSetup && m_helpEngine->registeredDocumentations().count() > 0) { - m_helpEngine->setupData(); - m_helpEngineNeedsSetup = false; } if (!m_toolTip.isEmpty()) m_toolTip = Qt::escape(m_toolTip); - if (!m_helpId.isEmpty() && !m_helpEngine->linksForIdentifier(m_helpId).isEmpty()) { + if (!m_helpId.isEmpty()) { if (showF1) { - m_toolTip = QString(QLatin1String("