From 5cb22e50216b3e8831ad247c8fcd1dfcfc131d87 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 13 Jun 2013 16:02:27 +0200 Subject: CppEditor: Fix highlighting in new split if file is changed externally For a new split/editor no CppHighlightingSupport was set since onMimeTypeChanged was not called. Now the CppHighlightingSupport is set again in the constructor. This reverts partly commit 033ad887 C++: handle file type changes for choosing highlighters Task-number: QTCREATORBUG-9382 Change-Id: Ie79d357d570bec4920366fbd56fb67859be9b37a Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cpptoolseditorsupport.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp') diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 45d970d475..7993ccd7dd 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -115,10 +115,16 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor , m_cachedContentsEditorRevision(-1) , m_initialized(false) , m_lastHighlightRevision(0) + , m_highlightingSupport(modelManager->highlightingSupport(textEditor)) { connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), this, SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr))); + if (m_highlightingSupport && m_highlightingSupport->requiresSemanticInfo()) { + connect(this, SIGNAL(semanticInfoUpdated(CppTools::SemanticInfo)), + this, SLOT(startHighlighting())); + } + m_updateDocumentTimer = new QTimer(this); m_updateDocumentTimer->setSingleShot(true); m_updateDocumentTimer->setInterval(m_updateDocumentInterval); @@ -135,6 +141,8 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor connect(m_textEditor->document(), SIGNAL(mimeTypeChanged()), this, SLOT(onMimeTypeChanged())); + + updateDocument(); } CppEditorSupport::~CppEditorSupport() -- cgit v1.2.1