summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/plaintexteditorfactory.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-08-27 11:19:04 +0200
committerhjk <hjk121@nokiamail.com>2014-08-27 12:35:32 +0200
commit7b67701dea2aa6ff046bcffdbec70f7fd941599e (patch)
treec3c22ed73e481e07ec4bdc8bc02deadc5b5016ab /src/plugins/texteditor/plaintexteditorfactory.cpp
parent59f1ffd9d24726a22f135fc66f9d073e38575141 (diff)
downloadqt-creator-7b67701dea2aa6ff046bcffdbec70f7fd941599e.tar.gz
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 <christian.stenger@digia.com>
Diffstat (limited to 'src/plugins/texteditor/plaintexteditorfactory.cpp')
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp17
1 files changed, 14 insertions, 3 deletions
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 <utils/qtcassert.h>
#include <QCoreApplication>
-#include <QDebug>
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<BaseTextEditor *>(m_instance->createEditor());
+}
+
} // namespace TextEditor