AutoTest: Avoid unneeded duplication on rebuild

When the rebuild of the tree model has been triggered
due to switching between grouping by filter or directory
it could happen that some children did not get merged
into others due to (insignificant) differences.
Avoid this visual duplication by finding items similar
to the one to be added and if there is one re-use this
instead.

Change-Id: Ife49593638e0af23ffc7353e305be4ea25eb2180
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-03-13 13:38:43 +01:00
parent db2e962a2f
commit 96ccb95e6f
9 changed files with 108 additions and 1 deletions

View File

@@ -229,6 +229,13 @@ TestTreeItem *TestTreeItem::findChildByFile(const QString &filePath)
});
}
TestTreeItem *TestTreeItem::findChildByFileAndType(const QString &filePath, Type tType)
{
return findChildBy([filePath, tType](const TestTreeItem *other) {
return other->type() == tType && other->filePath() == filePath;
});
}
TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const QString &filePath)
{
return findChildBy([name, filePath](const TestTreeItem *other) -> bool {