From 7b67701dea2aa6ff046bcffdbec70f7fd941599e Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 27 Aug 2014 11:19:04 +0200 Subject: TextEditor: Fix failure in cpptools autotest The issue only appeared in the test due to the different editor construction there. Now use the same factory access. Change-Id: I3a8534fbe683bb88f04ad68850cecdfe32b11433 Reviewed-by: Christian Stenger --- src/plugins/texteditor/plaintexteditorfactory.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/plugins/texteditor/plaintexteditorfactory.cpp') diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index 33e8de572e..dbe83566e4 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -41,10 +41,10 @@ #include #include -#include namespace TextEditor { -namespace Internal { + +static PlainTextEditorFactory *m_instance = 0; class PlainTextEditorWidget : public BaseTextEditorWidget { @@ -55,6 +55,8 @@ public: PlainTextEditorFactory::PlainTextEditorFactory() { + QTC_CHECK(!m_instance); + m_instance = this; setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)); @@ -69,5 +71,14 @@ PlainTextEditorFactory::PlainTextEditorFactory() TextEditorActionHandler::UnCollapseAll); } -} // namespace Internal +PlainTextEditorFactory *PlainTextEditorFactory::instance() +{ + return m_instance; +} + +BaseTextEditor *PlainTextEditorFactory::createPlainTextEditor() +{ + return qobject_cast(m_instance->createEditor()); +} + } // namespace TextEditor -- cgit v1.2.1