diff options
author | Leandro Melo <leandro.melo@nokia.com> | 2011-01-17 16:29:57 +0100 |
---|---|---|
committer | Leandro Melo <leandro.melo@nokia.com> | 2011-01-17 16:35:04 +0100 |
commit | bcaf20319df7c0d0db5086c2c187a9c5a1800074 (patch) | |
tree | 1dc892bd31f72ab4f9db95e5d16050c0bc48dcf2 /src/plugins/cppeditor/cpphoverhandler.cpp | |
parent | 51c4740266b993c4b51b6c71dace82ed76e4bdf1 (diff) |
C++ editor: Try to find a help item if there is a syntax error
Task-number: QTCREATORBUG-2674
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r-- | src/plugins/cppeditor/cpphoverhandler.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index 764af2bfe7..eb136cc9b0 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -78,9 +78,15 @@ void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) CppElementEvaluator evaluator(cppEditor); evaluator.setTextCursor(tc); - QSharedPointer<CppElement> cppElement = evaluator.identifyCppElement(); - if (!cppElement.isNull()) { - setToolTip(cppElement->tooltip()); + evaluator.execute(); + if (evaluator.hasDiagnosis()) { + setToolTip(evaluator.diagnosis()); + setIsDiagnosticTooltip(true); + } + if (evaluator.identifiedCppElement()) { + const QSharedPointer<CppElement> &cppElement = evaluator.cppElement(); + if (!isDiagnosticTooltip()) + setToolTip(cppElement->tooltip()); foreach (const QString &helpId, cppElement->helpIdCandidates()) { if (!Core::HelpManager::instance()->linksForIdentifier(helpId).isEmpty()) { setLastHelpItemIdentified(TextEditor::HelpItem(helpId, @@ -98,6 +104,9 @@ void CppHoverHandler::decorateToolTip() if (Qt::mightBeRichText(toolTip())) setToolTip(Qt::escape(toolTip())); + if (isDiagnosticTooltip()) + return; + const TextEditor::HelpItem &help = lastHelpItemIdentified(); if (help.isValid()) { // If Qt is built with a namespace, we still show the tip without it, as |