forked from qt-creator/qt-creator
TextEditor: Remove indenter construction from PlainTextEditorWidget
Do it in the users "that know" and remove the special constructor case. Change-Id: I9298c8d13118068adc7958c0894dccb7af4d7855 Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
QScopedPointer<TextEditor::BaseTextEditorWidget> editorWidget(
|
QScopedPointer<TextEditor::BaseTextEditorWidget> editorWidget(
|
||||||
new TextEditor::PlainTextEditorWidget);
|
new TextEditor::PlainTextEditorWidget(new TextEditor::PlainTextDocument));
|
||||||
QString error;
|
QString error;
|
||||||
editorWidget->open(&error, document->fileName(), document->fileName());
|
editorWidget->open(&error, document->fileName(), document->fileName());
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(error.isEmpty());
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
#include <texteditor/plaintexteditor.h>
|
#include <texteditor/plaintexteditor.h>
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
#include <texteditor/normalindenter.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
@@ -165,7 +166,9 @@ void BarDescriptorEditorWidget::initAssetsPage()
|
|||||||
|
|
||||||
void BarDescriptorEditorWidget::initSourcePage()
|
void BarDescriptorEditorWidget::initSourcePage()
|
||||||
{
|
{
|
||||||
m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(this);
|
auto doc = new TextEditor::PlainTextDocument;
|
||||||
|
doc->setIndenter(new TextEditor::NormalIndenter);
|
||||||
|
m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(doc, this);
|
||||||
addWidget(m_xmlSourceWidget);
|
addWidget(m_xmlSourceWidget);
|
||||||
|
|
||||||
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
|
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
|
||||||
|
|||||||
@@ -66,14 +66,6 @@ PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
|
|||||||
setDuplicateSupported(true);
|
setDuplicateSupported(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
|
|
||||||
: BaseTextEditorWidget(new PlainTextDocument(), parent)
|
|
||||||
{
|
|
||||||
// Currently only "normal" indentation is supported.
|
|
||||||
baseTextDocument()->setIndenter(new NormalIndenter);
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
PlainTextEditorWidget::PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent)
|
PlainTextEditorWidget::PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent)
|
||||||
: BaseTextEditorWidget(doc, parent)
|
: BaseTextEditorWidget(doc, parent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class TEXTEDITOR_EXPORT PlainTextEditorWidget : public BaseTextEditorWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlainTextEditorWidget(QWidget *parent = 0);
|
|
||||||
PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent = 0);
|
PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent = 0);
|
||||||
PlainTextEditorWidget(PlainTextEditorWidget *other);
|
PlainTextEditorWidget(PlainTextEditorWidget *other);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "plaintexteditorfactory.h"
|
#include "plaintexteditorfactory.h"
|
||||||
#include "plaintexteditor.h"
|
#include "plaintexteditor.h"
|
||||||
#include "basetextdocument.h"
|
#include "basetextdocument.h"
|
||||||
|
#include "normalindenter.h"
|
||||||
#include "texteditoractionhandler.h"
|
#include "texteditoractionhandler.h"
|
||||||
#include "texteditorconstants.h"
|
#include "texteditorconstants.h"
|
||||||
#include "texteditorplugin.h"
|
#include "texteditorplugin.h"
|
||||||
@@ -60,12 +61,14 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
|
|||||||
|
|
||||||
Core::IEditor *PlainTextEditorFactory::createEditor()
|
Core::IEditor *PlainTextEditorFactory::createEditor()
|
||||||
{
|
{
|
||||||
PlainTextEditorWidget *rc = new PlainTextEditorWidget();
|
auto doc = new PlainTextDocument;
|
||||||
TextEditorSettings::initializeEditor(rc);
|
doc->setIndenter(new NormalIndenter);
|
||||||
connect(rc, SIGNAL(configured(Core::IEditor*)),
|
auto widget = new PlainTextEditorWidget(doc);
|
||||||
|
TextEditorSettings::initializeEditor(widget);
|
||||||
|
connect(widget, SIGNAL(configured(Core::IEditor*)),
|
||||||
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
|
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
|
||||||
updateEditorInfoBar(rc->editor());
|
updateEditorInfoBar(widget->editor());
|
||||||
return rc->editor();
|
return widget->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
Reference in New Issue
Block a user