QmlJS: Avoid frequent libraryInfoUpdated emissions.

Also don't require a rehighlight of every open document when the
signal is emitted.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2011-01-12 13:58:24 +01:00
parent 033a0ff12e
commit ef5dc8c699
3 changed files with 21 additions and 6 deletions

View File

@@ -676,7 +676,7 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
connect(m_modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)),
this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr)));
connect(m_modelManager, SIGNAL(libraryInfoUpdated(QString,QmlJS::LibraryInfo)),
this, SLOT(forceSemanticRehighlight()));
this, SLOT(forceSemanticRehighlightIfCurrentEditor()));
connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool)));
}
@@ -1465,6 +1465,13 @@ void QmlJSTextEditor::forceSemanticRehighlight()
m_semanticHighlighter->rehighlight(currentSource(/* force = */ true));
}
void QmlJSEditor::QmlJSTextEditor::forceSemanticRehighlightIfCurrentEditor()
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (editorManager->currentEditor() == editableInterface())
forceSemanticRehighlight();
}
void QmlJSTextEditor::semanticRehighlight()
{
m_semanticHighlighter->rehighlight(currentSource());