diff options
author | Christian Stenger <christian.stenger@qt.io> | 2018-01-23 10:22:45 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2018-01-24 12:02:24 +0000 |
commit | 17c64e27f8b47a03fee3c748d0caf20d24c1cce6 (patch) | |
tree | b11a7e22cdf75f849a1b9df9d67681acbdc9d77a /src/libs/utils/treemodel.cpp | |
parent | 6b38c73205135834cd30fb2efea613b05f677127 (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.cpp | 4 |
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; } |