forked from qt-creator/qt-creator
TextEditor: Return BaseTextEditor for duplicate
Because the type is always a BaseTextEditor we can return a BaseTextEditor type. C++ is allowing to change the overload return type so long it is compatible. Change-Id: Ib4c88faaa6fdfb97fd03c51a120de0fa0c2d00cd Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -80,8 +80,7 @@ void TextEditorView::modelAttached(Model *model)
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
auto textEditor = Utils::UniqueObjectLatePtr<TextEditor::BaseTextEditor>(
|
||||
static_cast<TextEditor::BaseTextEditor *>(
|
||||
QmlDesignerPlugin::instance()->currentDesignDocument()->textEditor()->duplicate()));
|
||||
QmlDesignerPlugin::instance()->currentDesignDocument()->textEditor()->duplicate());
|
||||
|
||||
// Set the context of the text editor, but we add another special context to override shortcuts.
|
||||
Core::Context context = textEditor->context();
|
||||
|
||||
@@ -8940,11 +8940,11 @@ BaseTextEditor *TextEditorFactoryPrivate::createEditorHelper(const TextDocumentP
|
||||
return editor;
|
||||
}
|
||||
|
||||
IEditor *BaseTextEditor::duplicate()
|
||||
BaseTextEditor *BaseTextEditor::duplicate()
|
||||
{
|
||||
// Use new standard setup if that's available.
|
||||
if (d->m_origin) {
|
||||
IEditor *dup = d->m_origin->duplicateTextEditor(this);
|
||||
BaseTextEditor *dup = d->m_origin->duplicateTextEditor(this);
|
||||
emit editorDuplicated(dup);
|
||||
return dup;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
// IEditor
|
||||
Core::IDocument *document() const override;
|
||||
|
||||
IEditor *duplicate() override;
|
||||
BaseTextEditor *duplicate() override;
|
||||
|
||||
QByteArray saveState() const override;
|
||||
void restoreState(const QByteArray &state) override;
|
||||
|
||||
Reference in New Issue
Block a user