aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/treemodel.cpp
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2018-01-23 10:22:45 +0100
committerChristian Stenger <christian.stenger@qt.io>2018-01-24 12:02:24 +0000
commit17c64e27f8b47a03fee3c748d0caf20d24c1cce6 (patch)
treeb11a7e22cdf75f849a1b9df9d67681acbdc9d77a /src/libs/utils/treemodel.cpp
parent6b38c73205135834cd30fb2efea613b05f677127 (diff)
Utils: Change processing of children in reverseFindAnyChild()
This changes the processing of children to step down into the children first (and their children recursively) instead of just processing direct children in reverse. Fixes an issue with AutoTest plugin where results of data tags got a new intermediate although there was already one present. Change-Id: I1fe42942db975c7a1aa3ddb0b6596979c1164dd7 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils/treemodel.cpp')
-rw-r--r--src/libs/utils/treemodel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp
index 61a6a8974c1..6c182ba48e6 100644
--- a/src/libs/utils/treemodel.cpp
+++ b/src/libs/utils/treemodel.cpp
@@ -866,10 +866,10 @@ TreeItem *TreeItem::reverseFindAnyChild(const std::function<bool (TreeItem *)> &
{
auto end = m_children.rend();
for (auto it = m_children.rbegin(); it != end; ++it) {
- if (pred(*it))
- return *it;
if (TreeItem *found = (*it)->reverseFindAnyChild(pred))
return found;
+ if (pred(*it))
+ return *it;
}
return nullptr;
}