QmlJSEditor: Partially move construction to new setup scheme

Change-Id: I61a6c4a51124b624d77a3b484c1f20ef5105f62a
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-21 09:56:08 +02:00
parent 307129bf8f
commit 62acde4693

View File

@@ -175,8 +175,11 @@ QModelIndex QmlJSTextEditorWidget::outlineModelIndex()
IEditor *QmlJSEditor::duplicate()
{
QmlJSTextEditorWidget *newEditor = new QmlJSTextEditorWidget(editorWidget()->textDocumentPtr());
return newEditor->editor();
auto editor = new QmlJSEditor;
auto widget = new QmlJSTextEditorWidget(editorWidget()->textDocumentPtr());
editor->setEditorWidget(widget);
editor->configureCodeAssistant();
return editor;
}
bool QmlJSEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
@@ -535,7 +538,7 @@ bool QmlJSTextEditorWidget::isClosingBrace(const QList<Token> &tokens) const
BaseTextEditor *QmlJSTextEditorWidget::createEditor()
{
return new QmlJSEditor;
QTC_ASSERT("should not happen anymore" && false, return 0);
}
void QmlJSTextEditorWidget::createToolBar()
@@ -928,8 +931,10 @@ QmlJSEditorFactory::QmlJSEditorFactory()
IEditor *QmlJSEditorFactory::createEditor()
{
QmlJSTextEditorWidget *rc = new QmlJSTextEditorWidget(BaseTextDocumentPtr(new QmlJSEditorDocument));
return rc->editor();
auto editor = new QmlJSEditor;
editor->setEditorWidget(new QmlJSTextEditorWidget(BaseTextDocumentPtr(new QmlJSEditorDocument)));
editor->configureCodeAssistant();
return editor;
}
} // namespace Internal