From 7a08a3a4b9ea26677f40cb0dc8a98b23542e49fa Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 11 Feb 2020 17:55:15 +0100 Subject: [PATCH] ScxmlEditor: Make ScxmlEditorFactory independent of QObject inheritance Change-Id: I11412b850869c8295e9eed9ed74ff4f7dcbcf8b2 Reviewed-by: Christian Stenger --- src/plugins/scxmleditor/scxmleditordata.cpp | 3 +-- src/plugins/scxmleditor/scxmleditordata.h | 2 +- src/plugins/scxmleditor/scxmleditorfactory.cpp | 7 ++++++- src/plugins/scxmleditor/scxmleditorfactory.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/scxmleditor/scxmleditordata.cpp b/src/plugins/scxmleditor/scxmleditordata.cpp index 394b00533c3..14d9c26e18b 100644 --- a/src/plugins/scxmleditor/scxmleditordata.cpp +++ b/src/plugins/scxmleditor/scxmleditordata.cpp @@ -87,8 +87,7 @@ public: } }; -ScxmlEditorData::ScxmlEditorData(QObject *parent) - : QObject(parent) +ScxmlEditorData::ScxmlEditorData() { m_contexts.add(ScxmlEditor::Constants::C_SCXMLEDITOR); diff --git a/src/plugins/scxmleditor/scxmleditordata.h b/src/plugins/scxmleditor/scxmleditordata.h index 25054ecb3ab..0cd4bf71192 100644 --- a/src/plugins/scxmleditor/scxmleditordata.h +++ b/src/plugins/scxmleditor/scxmleditordata.h @@ -46,7 +46,7 @@ class ScxmlEditorData : public QObject { Q_OBJECT public: - ScxmlEditorData(QObject *parent = nullptr); + ScxmlEditorData(); ~ScxmlEditorData() override; void fullInit(); diff --git a/src/plugins/scxmleditor/scxmleditorfactory.cpp b/src/plugins/scxmleditor/scxmleditorfactory.cpp index a18132f9846..56d707173e8 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.cpp +++ b/src/plugins/scxmleditor/scxmleditorfactory.cpp @@ -48,7 +48,7 @@ ScxmlEditorFactory::ScxmlEditorFactory() setEditorCreator([this] { if (!m_editorData) { - m_editorData = new ScxmlEditorData(this); + m_editorData = new ScxmlEditorData; QGuiApplication::setOverrideCursor(Qt::WaitCursor); m_editorData->fullInit(); QGuiApplication::restoreOverrideCursor(); @@ -56,3 +56,8 @@ ScxmlEditorFactory::ScxmlEditorFactory() return m_editorData->createEditor(); }); } + +ScxmlEditorFactory::~ScxmlEditorFactory() +{ + delete m_editorData; +} diff --git a/src/plugins/scxmleditor/scxmleditorfactory.h b/src/plugins/scxmleditor/scxmleditorfactory.h index f4424f613c7..7dd3393da5f 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.h +++ b/src/plugins/scxmleditor/scxmleditorfactory.h @@ -36,6 +36,7 @@ class ScxmlEditorFactory final : public Core::IEditorFactory { public: ScxmlEditorFactory(); + ~ScxmlEditorFactory(); private: ScxmlEditorData* m_editorData = nullptr;