diff options
author | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-09-04 11:02:14 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-10-02 10:42:32 +0300 |
commit | b4dcfc1d91872fae64466da8b38bdcb9e1fad855 (patch) | |
tree | 8036cfdf62bc9627c2cff287d757d377631fe064 /plugins/autotest/testtreemodel.cpp | |
parent | 0d01a0c7bfe2c80700b64e1b56c1172cc99a6f45 (diff) | |
download | qt-creator-b4dcfc1d91872fae64466da8b38bdcb9e1fad855.tar.gz |
Let TestTreeItem handle its parent
Part of preparing to re-use QC's TreeModel/TreeItem for
TestTreeModel/TestTreeItem.
Change-Id: Ieab26e9061790dd4c3d8dc64ce292727a17977f7
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'plugins/autotest/testtreemodel.cpp')
-rw-r--r-- | plugins/autotest/testtreemodel.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 0b43688982..9f0cf75a27 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -41,8 +41,8 @@ namespace Internal { TestTreeModel::TestTreeModel(QObject *parent) : QAbstractItemModel(parent), m_rootItem(new TestTreeItem(QString(), QString(), TestTreeItem::ROOT)), - m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::ROOT, m_rootItem)), - m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::ROOT, m_rootItem)), + m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::ROOT)), + m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::ROOT)), m_parser(new TestCodeParser(this)), m_connectionsInitialized(false) { @@ -664,7 +664,6 @@ void TestTreeModel::addTestTreeItem(const TestTreeItem &item, TestTreeModel::Typ TestTreeItem *parent = rootItemForType(type); QModelIndex index = rootIndexForType(type); TestTreeItem *toBeAdded = new TestTreeItem(item); - toBeAdded->setParent(parent); beginInsertRows(index, parent->childCount(), parent->childCount()); parent->appendChild(toBeAdded); @@ -680,7 +679,6 @@ void TestTreeModel::addTestTreeItems(const QList<TestTreeItem> &itemList, TestTr beginInsertRows(index, parent->childCount(), parent->childCount() + itemList.size() - 1); foreach (const TestTreeItem &item, itemList) { TestTreeItem *toBeAdded = new TestTreeItem(item); - toBeAdded->setParent(parent); parent->appendChild(toBeAdded); } endInsertRows(); @@ -693,12 +691,12 @@ void TestTreeModel::updateUnnamedQuickTest(const QString &fileName, const QStrin removeUnnamedQuickTests(fileName); TestTreeItem unnamed = hasUnnamedQuickTests() ? TestTreeItem(*unnamedQuickTests()) - : TestTreeItem(QString(), QString(), TestTreeItem::TEST_CLASS, rootItemForType(QuickTest)); + : TestTreeItem(QString(), QString(), TestTreeItem::TEST_CLASS); foreach (const QString &functionName, functions.keys()) { const TestCodeLocationAndType locationAndType = functions.value(functionName); TestTreeItem *testFunction = new TestTreeItem(functionName, locationAndType.m_name, - locationAndType.m_type, &unnamed); + locationAndType.m_type); testFunction->setLine(locationAndType.m_line); testFunction->setColumn(locationAndType.m_column); testFunction->setMainFile(mainFile); @@ -714,7 +712,6 @@ void TestTreeModel::modifyTestTreeItem(TestTreeItem item, TestTreeModel::Type ty { QModelIndex index = rootIndexForType(type); TestTreeItem *parent = rootItemForType(type); - item.setParent(parent); if (file.isEmpty()) { if (TestTreeItem *unnamed = unnamedQuickTests()) { index = index.child(unnamed->row(), 0); @@ -805,7 +802,6 @@ void TestTreeModel::modifyTestSubtree(QModelIndex &toBeModifiedIndex, const Test for (int row = childCount; row < newChildCount; ++row) { TestTreeItem *newChild = newItem.child(row); TestTreeItem *toBeAdded = new TestTreeItem(*newChild); - toBeAdded->setParent(toBeModifiedItem); if (checkStates.contains(toBeAdded->name()) && checkStates.value(toBeAdded->name()) != Qt::Checked) toBeAdded->setChecked(checkStates.value(toBeAdded->name())); |