forked from qt-creator/qt-creator
TextEditors: Avoid changing document after construction.
Also when duplicating editors, we don't want to change the document after construction. Actually at some places (e.g. CppEditorSupport creation) we don't handle document changes correctly, and we are only lucky that things still (more or less?) work. Get rid of BaseTextEditorWidget::duplicateFrom and use copy-constructor style instead. Change-Id: I7f688b7fcc51d1bb5e222bb333f0d28479b597a6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -93,9 +93,8 @@ bool ProjectFilesEditor::duplicateSupported() const
|
||||
|
||||
Core::IEditor *ProjectFilesEditor::duplicate()
|
||||
{
|
||||
ProjectFilesEditorWidget *parentEditor = qobject_cast<ProjectFilesEditorWidget *>(editorWidget());
|
||||
ProjectFilesEditorWidget *editor = new ProjectFilesEditorWidget();
|
||||
editor->duplicateFrom(parentEditor);
|
||||
ProjectFilesEditorWidget *editor = new ProjectFilesEditorWidget(
|
||||
qobject_cast<ProjectFilesEditorWidget *>(editorWidget()));
|
||||
TextEditorSettings::initializeEditor(editor);
|
||||
return editor->editor();
|
||||
}
|
||||
@@ -111,6 +110,11 @@ ProjectFilesEditorWidget::ProjectFilesEditorWidget(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
ProjectFilesEditorWidget::ProjectFilesEditorWidget(ProjectFilesEditorWidget *other)
|
||||
: BaseTextEditorWidget(other)
|
||||
{
|
||||
}
|
||||
|
||||
BaseTextEditor *ProjectFilesEditorWidget::createEditor()
|
||||
{
|
||||
return new ProjectFilesEditor(this);
|
||||
|
||||
Reference in New Issue
Block a user