TextEditors: Remove widget's setTabSettings method

Change-Id: If212b45e2d526534b7853f3fa23b170f61e1976e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Eike Ziller
2014-01-17 17:09:15 +01:00
parent f506104f29
commit 4eff289e03
16 changed files with 102 additions and 62 deletions

View File

@@ -58,14 +58,14 @@ PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
}
PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
: BaseTextEditorWidget(parent)
: BaseTextEditorWidget(new PlainTextDocument(), parent)
{
// Currently only "normal" indentation is supported.
baseTextDocument()->setIndenter(new NormalIndenter);
ctor();
}
PlainTextEditorWidget::PlainTextEditorWidget(BaseTextDocument *doc, QWidget *parent)
PlainTextEditorWidget::PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent)
: BaseTextEditorWidget(doc, parent)
{
ctor();
@@ -111,17 +111,6 @@ void PlainTextEditorWidget::unCommentSelection()
Utils::unCommentSelection(this, m_commentDefinition);
}
void PlainTextEditorWidget::setTabSettings(const TextEditor::TabSettings &ts)
{
BaseTextEditorWidget::setTabSettings(ts);
if (baseTextDocument()->syntaxHighlighter()) {
Highlighter *highlighter =
static_cast<Highlighter *>(baseTextDocument()->syntaxHighlighter());
highlighter->setTabSettings(ts);
}
}
void PlainTextEditorWidget::configure()
{
MimeType mimeType;
@@ -188,4 +177,15 @@ void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS);
}
PlainTextDocument::PlainTextDocument()
{
connect(this, SIGNAL(tabSettingsChanged()), this, SLOT(updateTabSettings()));
}
void PlainTextDocument::updateTabSettings()
{
if (Highlighter *highlighter = qobject_cast<Highlighter *>(syntaxHighlighter()))
highlighter->setTabSettings(tabSettings());
}
} // namespace TextEditor