aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotest/itestframework.h
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-03-16 12:59:23 +0100
committerhjk <hjk@qt.io>2020-03-20 13:13:52 +0000
commit7158e676121767f43ac542cc3c958d8ed1279436 (patch)
tree137b76ec4b13305c303ed976004aa20bd78852c5 /src/plugins/autotest/itestframework.h
parenta596421ffcda6960243f7e0012c21e778a4b20f0 (diff)
AutoTest: Move TestCodeParser and TestTreeModel ownership to plugin pimpl
Change-Id: I01b32aae894a4b419c8a067f604d5f04a2b14dfe Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/autotest/itestframework.h')
-rw-r--r--src/plugins/autotest/itestframework.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/autotest/itestframework.h b/src/plugins/autotest/itestframework.h
index bc3e5cb386..8d81b28289 100644
--- a/src/plugins/autotest/itestframework.h
+++ b/src/plugins/autotest/itestframework.h
@@ -38,7 +38,6 @@ public:
explicit ITestFramework(bool activeByDefault) : m_active(activeByDefault) {}
virtual ~ITestFramework()
{
- delete m_rootNode;
delete m_testParser;
}
@@ -50,6 +49,7 @@ public:
TestTreeItem *rootNode()
{ if (!m_rootNode)
m_rootNode = createRootNode();
+ // These are stored in the TestTreeModel and destroyed on shutdown there.
return m_rootNode;
}
@@ -70,6 +70,17 @@ public:
void setGrouping(bool group) { m_grouping = group; }
// framework specific tool tip to be displayed on the general settings page
virtual QString groupingToolTip() const { return QString(); }
+
+ void resetRootNode()
+ {
+ if (!m_rootNode)
+ return;
+ if (m_rootNode->model())
+ static_cast<TestTreeModel *>(m_rootNode->model())->takeItem(m_rootNode);
+ delete m_rootNode;
+ m_rootNode = nullptr;
+ }
+
protected:
virtual ITestParser *createTestParser() = 0;
virtual TestTreeItem *createRootNode() const = 0;