There's no need to store the diagnostic messages in the editor.

Store the error message in the QTextCharFormat of the extra selection.
This commit is contained in:
Roberto Raggi
2010-01-26 14:03:37 +01:00
parent f995022af7
commit e622d70617
3 changed files with 12 additions and 20 deletions

View File

@@ -158,16 +158,14 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
QTextCursor tc(scriptEditor->document());
tc.setPosition(pos);
const unsigned lineNumber = tc.block().blockNumber() + 1;
// We only want to show F1 if the tooltip matches the help id
bool showF1 = true;
foreach (const QmlJS::DiagnosticMessage &m, scriptEditor->diagnosticMessages()) {
if (m.loc.startLine == lineNumber) {
m_toolTip = m.message;
foreach (const QTextEdit::ExtraSelection &sel, scriptEditor->extraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection)) {
if (pos >= sel.cursor.selectionStart() && pos <= sel.cursor.selectionEnd()) {
showF1 = false;
break;
m_toolTip = sel.format.toolTip();
}
}