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