Commit 3c3c896d authored by hjk's avatar hjk

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: default avatarhjk <hjk121@nokiamail.com>
parent 4a52d821
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <cpptools/cppcompletionassistprovider.h> #include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cpphighlightingsupport.h> #include <cpptools/cpphighlightingsupport.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppqtstyleindenter.h>
#include <cpptools/cppsemanticinfo.h> #include <cpptools/cppsemanticinfo.h>
#include <cpptools/cpptoolseditorsupport.h> #include <cpptools/cpptoolseditorsupport.h>
#include <cpptools/cpptoolsplugin.h> #include <cpptools/cpptoolsplugin.h>
...@@ -179,7 +178,6 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q) ...@@ -179,7 +178,6 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
CppEditorWidget::CppEditorWidget(QWidget *parent) CppEditorWidget::CppEditorWidget(QWidget *parent)
: TextEditor::BaseTextEditorWidget(new CPPEditorDocument(), parent) : TextEditor::BaseTextEditorWidget(new CPPEditorDocument(), parent)
{ {
textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
ctor(); ctor();
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "cpphighlighter.h" #include "cpphighlighter.h"
#include <cpptools/cppcodeformatter.h> #include <cpptools/cppcodeformatter.h>
#include <cpptools/cppqtstyleindenter.h>
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <QTextDocument> #include <QTextDocument>
...@@ -48,6 +49,7 @@ CPPEditorDocument::CPPEditorDocument() ...@@ -48,6 +49,7 @@ CPPEditorDocument::CPPEditorDocument()
connect(this, SIGNAL(mimeTypeChanged()), connect(this, SIGNAL(mimeTypeChanged()),
this, SLOT(onMimeTypeChanged())); this, SLOT(onMimeTypeChanged()));
setSyntaxHighlighter(new CppHighlighter); setSyntaxHighlighter(new CppHighlighter);
setIndenter(new CppTools::CppQtStyleIndenter);
onMimeTypeChanged(); onMimeTypeChanged();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment