Designer: Move DesignerXmlEditorWidget creation closer to new setup

Not yet the precise setup, but good enough for a non-duplicatable
editor.

Change-Id: I2c8156fef73985457aab61d72b853a9b3f604cbc
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-21 08:49:56 +02:00
parent e560ef82ef
commit 8213a88d3e
2 changed files with 6 additions and 9 deletions
@@ -29,7 +29,8 @@
#include "designerxmleditorwidget.h"
#include "formwindoweditor.h"
#include "designerconstants.h"
#include <utils/qtcassert.h>
#include <QDesignerFormWindowInterface>
#include <QDebug>
@@ -41,7 +42,8 @@ DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *f
{
TextEditor::BaseTextDocumentPtr doc(new FormWindowFile(form));
setTextDocument(doc);
m_designerEditor = new FormWindowEditor(this);
auto editor = new FormWindowEditor(this);
editor->setEditorWidget(this);
setupAsPlainEditor();
setReadOnly(true);
configureMimeType(doc->mimeType());
@@ -49,14 +51,12 @@ DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *f
TextEditor::BaseTextEditor *DesignerXmlEditorWidget::createEditor()
{
if (Designer::Constants::Internal::debug)
qDebug() << "DesignerXmlEditor::createEditableInterface()";
return m_designerEditor;
QTC_ASSERT("should not happen anymore" && false, return 0);
}
FormWindowEditor *DesignerXmlEditorWidget::designerEditor() const
{
return m_designerEditor;
return qobject_cast<FormWindowEditor *>(editor());
}
Internal::FormWindowFile *DesignerXmlEditorWidget::formWindowFile() const
@@ -64,9 +64,6 @@ public:
protected:
virtual TextEditor::BaseTextEditor *createEditor();
private:
FormWindowEditor *m_designerEditor;
};
} // Internal