forked from qt-creator/qt-creator
CppEditor: Move indenter construction to document constructor
A more direct approach than going through the widget's baseTextDocument, relying on widget life time. Change-Id: I62c10e53b1a9a1e6717c6eb3e3cc78dcbfd2868e Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -49,7 +49,6 @@
|
||||
#include <cpptools/cppcompletionassistprovider.h>
|
||||
#include <cpptools/cpphighlightingsupport.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <cpptools/cppqtstyleindenter.h>
|
||||
#include <cpptools/cppsemanticinfo.h>
|
||||
#include <cpptools/cpptoolseditorsupport.h>
|
||||
#include <cpptools/cpptoolsplugin.h>
|
||||
@@ -179,7 +178,6 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
||||
CppEditorWidget::CppEditorWidget(QWidget *parent)
|
||||
: TextEditor::BaseTextEditorWidget(new CPPEditorDocument(), parent)
|
||||
{
|
||||
textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
|
||||
ctor();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "cpphighlighter.h"
|
||||
|
||||
#include <cpptools/cppcodeformatter.h>
|
||||
#include <cpptools/cppqtstyleindenter.h>
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
|
||||
#include <QTextDocument>
|
||||
@@ -48,6 +49,7 @@ CPPEditorDocument::CPPEditorDocument()
|
||||
connect(this, SIGNAL(mimeTypeChanged()),
|
||||
this, SLOT(onMimeTypeChanged()));
|
||||
setSyntaxHighlighter(new CppHighlighter);
|
||||
setIndenter(new CppTools::CppQtStyleIndenter);
|
||||
onMimeTypeChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user