AutoTest: Speed up finding parent items

We normally add new results to the last added
item, so processing the search for the parent
from bottom to top makes more sense and avoids
iterating over almost every item.

Change-Id: Iede08b9c0d4c80227d2e8fea9b002354f01d5b35
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2017-06-26 13:16:21 +02:00
parent df61f12970
commit 4edc715b1c
3 changed files with 15 additions and 1 deletions

View File

@@ -313,7 +313,7 @@ TestResultItem *TestResultModel::findParentItemFor(const TestResultItem *item,
TestResultItem *currentItem = static_cast<TestResultItem *>(it);
return currentItem->testResult()->isDirectParentOf(result, &needsIntermediate);
};
TestResultItem *parent = static_cast<TestResultItem *>(root->findAnyChild(predicate));
TestResultItem *parent = static_cast<TestResultItem *>(root->reverseFindAnyChild(predicate));
if (parent) {
if (needsIntermediate) {
// check if the intermediate is present already