forked from qt-creator/qt-creator
Utils: Make remaining TreeModel iterating functions 'const'
This follows the rest of similar functions. It is arguably abusing the C++ misfeature that 'const' only applies to the top level, but avoids re-typing the same implementations stanzas for otherwise needed const/non-const overloads. Change-Id: If90fc879b406fd94714995ff4c42a4ebe3c69faa Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -91,13 +91,13 @@ public:
|
||||
|
||||
// Levels are 1-based: Child at Level 1 is an immediate child.
|
||||
template <class T, typename Predicate>
|
||||
void forFirstLevelChildren(Predicate pred) {
|
||||
void forFirstLevelChildren(Predicate pred) const {
|
||||
foreach (TreeItem *item, m_children)
|
||||
pred(static_cast<T>(item));
|
||||
}
|
||||
|
||||
template <class T, typename Predicate>
|
||||
void forSecondLevelChildren(Predicate pred) {
|
||||
void forSecondLevelChildren(Predicate pred) const {
|
||||
foreach (TreeItem *item1, m_children)
|
||||
foreach (TreeItem *item2, item1->m_children)
|
||||
pred(static_cast<T>(item2));
|
||||
|
Reference in New Issue
Block a user