forked from qt-creator/qt-creator
TextEditors: Set syntax highlighter only once
Change-Id: Iad83e589be49aeab3f35420d071311c15ddac6b2 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -128,7 +128,6 @@ CMakeEditorWidget::CMakeEditorWidget(CMakeEditorWidget *other)
|
|||||||
|
|
||||||
void CMakeEditorWidget::ctor()
|
void CMakeEditorWidget::ctor()
|
||||||
{
|
{
|
||||||
baseTextDocument()->setSyntaxHighlighter(new CMakeHighlighter);
|
|
||||||
m_commentDefinition.clearCommentStyles();
|
m_commentDefinition.clearCommentStyles();
|
||||||
m_commentDefinition.singleLine = QLatin1Char('#');
|
m_commentDefinition.singleLine = QLatin1Char('#');
|
||||||
}
|
}
|
||||||
@@ -233,6 +232,7 @@ CMakeDocument::CMakeDocument()
|
|||||||
: TextEditor::BaseTextDocument()
|
: TextEditor::BaseTextDocument()
|
||||||
{
|
{
|
||||||
setMimeType(QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE));
|
setMimeType(QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE));
|
||||||
|
setSyntaxHighlighter(new CMakeHighlighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeDocument::defaultPath() const
|
QString CMakeDocument::defaultPath() const
|
||||||
|
|||||||
@@ -542,8 +542,6 @@ void CPPEditorWidget::ctor()
|
|||||||
setCodeFoldingSupported(true);
|
setCodeFoldingSupported(true);
|
||||||
setAutoCompleter(new CppAutoCompleter);
|
setAutoCompleter(new CppAutoCompleter);
|
||||||
|
|
||||||
baseTextDocument()->setSyntaxHighlighter(new CppHighlighter);
|
|
||||||
|
|
||||||
m_modelManager = CppModelManagerInterface::instance();
|
m_modelManager = CppModelManagerInterface::instance();
|
||||||
if (m_modelManager) {
|
if (m_modelManager) {
|
||||||
CppEditorSupport *editorSupport = m_modelManager->cppEditorSupport(editor());
|
CppEditorSupport *editorSupport = m_modelManager->cppEditorSupport(editor());
|
||||||
@@ -2001,6 +1999,7 @@ CPPEditorDocument::CPPEditorDocument()
|
|||||||
{
|
{
|
||||||
connect(this, SIGNAL(tabSettingsChanged()),
|
connect(this, SIGNAL(tabSettingsChanged()),
|
||||||
this, SLOT(invalidateFormatterCache()));
|
this, SLOT(invalidateFormatterCache()));
|
||||||
|
setSyntaxHighlighter(new CppHighlighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditorDocument::applyFontSettings()
|
void CPPEditorDocument::applyFontSettings()
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ ProFileEditorWidget::ProFileEditorWidget(ProFileEditorWidget *other)
|
|||||||
|
|
||||||
void ProFileEditorWidget::ctor()
|
void ProFileEditorWidget::ctor()
|
||||||
{
|
{
|
||||||
baseTextDocument()->setSyntaxHighlighter(new ProFileHighlighter);
|
|
||||||
m_commentDefinition.clearCommentStyles();
|
m_commentDefinition.clearCommentStyles();
|
||||||
m_commentDefinition.singleLine = QLatin1Char('#');
|
m_commentDefinition.singleLine = QLatin1Char('#');
|
||||||
}
|
}
|
||||||
@@ -211,6 +210,7 @@ ProFileDocument::ProFileDocument()
|
|||||||
: TextEditor::BaseTextDocument()
|
: TextEditor::BaseTextDocument()
|
||||||
{
|
{
|
||||||
setMimeType(QLatin1String(Constants::PROFILE_MIMETYPE));
|
setMimeType(QLatin1String(Constants::PROFILE_MIMETYPE));
|
||||||
|
setSyntaxHighlighter(new ProFileHighlighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProFileDocument::defaultPath() const
|
QString ProFileDocument::defaultPath() const
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) :
|
QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) :
|
||||||
TextEditor::BaseTextEditorWidget(parent)
|
TextEditor::BaseTextEditorWidget(new QmlJSEditorDocument, parent)
|
||||||
{
|
{
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
@@ -514,7 +514,6 @@ void QmlJSTextEditorWidget::ctor()
|
|||||||
m_cursorPositionTimer->setSingleShot(true);
|
m_cursorPositionTimer->setSingleShot(true);
|
||||||
connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow()));
|
connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow()));
|
||||||
|
|
||||||
baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
|
|
||||||
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||||
|
|
||||||
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
||||||
@@ -765,6 +764,7 @@ QmlJSEditorDocument::QmlJSEditorDocument()
|
|||||||
{
|
{
|
||||||
connect(this, SIGNAL(tabSettingsChanged()),
|
connect(this, SIGNAL(tabSettingsChanged()),
|
||||||
this, SLOT(invalidateFormatterCache()));
|
this, SLOT(invalidateFormatterCache()));
|
||||||
|
setSyntaxHighlighter(new Highlighter(document()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSEditorDocument::invalidateFormatterCache()
|
void QmlJSEditorDocument::invalidateFormatterCache()
|
||||||
|
|||||||
Reference in New Issue
Block a user