From c74714da045a6f087435b7f968b3039f0ce9323c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 24 Sep 2020 09:42:16 +0200 Subject: [PATCH] Remove parent argument from IEditor constructor Editors are owned by whoever created them via the corresponding editor factory, usually the EditorManager. Change-Id: I4432eab1a3a8c38ce1bba6bb10b0f9273695a524 Reviewed-by: hjk --- src/plugins/android/androidmanifesteditor.cpp | 2 +- src/plugins/coreplugin/editormanager/ieditor.cpp | 4 ++-- src/plugins/coreplugin/editormanager/ieditor.h | 2 +- src/plugins/imageviewer/imageviewer.cpp | 10 ++++------ src/plugins/imageviewer/imageviewer.h | 4 ++-- src/plugins/modeleditor/modeleditor.cpp | 11 +++++------ src/plugins/modeleditor/modeleditor.h | 5 ++--- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/plugins/android/androidmanifesteditor.cpp b/src/plugins/android/androidmanifesteditor.cpp index c3809ba7d73..5565001eadf 100644 --- a/src/plugins/android/androidmanifesteditor.cpp +++ b/src/plugins/android/androidmanifesteditor.cpp @@ -38,7 +38,7 @@ using namespace Android; using namespace Internal; AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget) - : Core::IEditor(editorWidget), m_toolBar(nullptr) + : m_toolBar(nullptr) { m_toolBar = new QToolBar(editorWidget); m_actionGroup = new QActionGroup(this); diff --git a/src/plugins/coreplugin/editormanager/ieditor.cpp b/src/plugins/coreplugin/editormanager/ieditor.cpp index e0dcb517a37..3ab59606d1b 100644 --- a/src/plugins/coreplugin/editormanager/ieditor.cpp +++ b/src/plugins/coreplugin/editormanager/ieditor.cpp @@ -103,8 +103,8 @@ namespace Core { /*! \internal */ -IEditor::IEditor(QObject *parent) - : IContext(parent), m_duplicateSupported(false) +IEditor::IEditor() + : m_duplicateSupported(false) {} /*! diff --git a/src/plugins/coreplugin/editormanager/ieditor.h b/src/plugins/coreplugin/editormanager/ieditor.h index b4626efc6b6..2b598337bfb 100644 --- a/src/plugins/coreplugin/editormanager/ieditor.h +++ b/src/plugins/coreplugin/editormanager/ieditor.h @@ -39,7 +39,7 @@ class CORE_EXPORT IEditor : public IContext Q_OBJECT public: - IEditor(QObject *parent = nullptr); + IEditor(); bool duplicateSupported() const; void setDuplicateSupported(bool duplicateSupported); diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp index 817cd5ea60a..7acdafda528 100644 --- a/src/plugins/imageviewer/imageviewer.cpp +++ b/src/plugins/imageviewer/imageviewer.cpp @@ -75,17 +75,15 @@ static bool updateButtonIconByTheme(QAbstractButton *button, const QString &name return false; } -ImageViewer::ImageViewer(QWidget *parent) - : IEditor(parent), - d(new ImageViewerPrivate) +ImageViewer::ImageViewer() + : d(new ImageViewerPrivate) { d->file.reset(new ImageViewerFile); ctor(); } -ImageViewer::ImageViewer(const QSharedPointer &document, QWidget *parent) - : IEditor(parent), - d(new ImageViewerPrivate) +ImageViewer::ImageViewer(const QSharedPointer &document) + : d(new ImageViewerPrivate) { d->file = document; ctor(); diff --git a/src/plugins/imageviewer/imageviewer.h b/src/plugins/imageviewer/imageviewer.h index 29e568021eb..4dbf2ecf46e 100644 --- a/src/plugins/imageviewer/imageviewer.h +++ b/src/plugins/imageviewer/imageviewer.h @@ -46,7 +46,7 @@ class ImageViewer : public Core::IEditor Q_OBJECT public: - explicit ImageViewer(QWidget *parent = nullptr); + ImageViewer(); ~ImageViewer() override; Core::IDocument *document() const override; @@ -69,7 +69,7 @@ public: void togglePlay(); private: - ImageViewer(const QSharedPointer &document, QWidget *parent = nullptr); + ImageViewer(const QSharedPointer &document); void ctor(); void playToggled(); void updatePauseAction(); diff --git a/src/plugins/modeleditor/modeleditor.cpp b/src/plugins/modeleditor/modeleditor.cpp index 8fc0655c58e..152ead0f215 100644 --- a/src/plugins/modeleditor/modeleditor.cpp +++ b/src/plugins/modeleditor/modeleditor.cpp @@ -141,16 +141,15 @@ public: QAction *syncEachOtherAction = nullptr; }; -ModelEditor::ModelEditor(UiController *uiController, ActionHandler *actionHandler, QWidget *parent) - : IEditor(parent), - d(new ModelEditorPrivate) +ModelEditor::ModelEditor(UiController *uiController, ActionHandler *actionHandler) + : d(new ModelEditorPrivate) { setContext(Core::Context(Constants::MODEL_EDITOR_ID)); d->uiController = uiController; d->actionHandler = actionHandler; d->document = new ModelDocument(this); connect(d->document, &ModelDocument::contentSet, this, &ModelEditor::onContentSet); - init(parent); + init(); } ModelEditor::~ModelEditor() @@ -206,13 +205,13 @@ bool ModelEditor::restoreState(const QByteArray &state) return false; } -void ModelEditor::init(QWidget *parent) +void ModelEditor::init() { // create and configure properties view d->propertiesView = new qmt::PropertiesView(this); // create and configure editor ui - d->rightSplitter = new Core::MiniSplitter(parent); + d->rightSplitter = new Core::MiniSplitter; connect(d->rightSplitter, &QSplitter::splitterMoved, this, &ModelEditor::onRightSplitterMoved); connect(d->uiController, &UiController::rightSplitterChanged, diff --git a/src/plugins/modeleditor/modeleditor.h b/src/plugins/modeleditor/modeleditor.h index 7491ce0f76b..70cdb62e33e 100644 --- a/src/plugins/modeleditor/modeleditor.h +++ b/src/plugins/modeleditor/modeleditor.h @@ -63,8 +63,7 @@ class ModelEditor : class ModelEditorPrivate; public: - explicit ModelEditor(UiController *uiController, ActionHandler *actionHandler, - QWidget *parent = nullptr); + ModelEditor(UiController *uiController, ActionHandler *actionHandler); ~ModelEditor(); Core::IDocument *document() const override; @@ -96,7 +95,7 @@ public: qmt::MPackage *guessSelectedPackage() const; private: - void init(QWidget *parent); + void init(); void initDocument(); void updateSelectedArea(SelectedArea selectedArea);