Commit 53415cec authored by hjk's avatar hjk Committed by hjk

Utils: Streamline TreeModel API

The LeveledTreeModel case is general enough to cover
the UniformTreeModel case, so merge them and rename to
TreeModel. The former TreeModel is now BaseTreeModel.

BaseTreeModels should not be instantiated directly,
a tree model with non-uniform basic items is available
as TreeModel<>.

Done-with: Eike Ziller <eike.ziller@qt.io>
Change-Id: I64a65617ab68c0cde39cf65f4bc092ef808ee6fb
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 24596522
......@@ -314,7 +314,7 @@ PluginView::PluginView(QWidget *parent)
m_categoryView->setSelectionMode(QAbstractItemView::SingleSelection);
m_categoryView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_model = new LeveledTreeModel<TreeItem, CollectionItem, PluginItem>(this);
m_model = new TreeModel<TreeItem, CollectionItem, PluginItem>(this);
m_model->setHeader({ tr("Name"), tr("Load"), tr("Version"), tr("Vendor") });
m_sortModel = new CategorySortFilterModel(this);
......@@ -368,7 +368,7 @@ void PluginView::setFilter(const QString &filter)
PluginSpec *PluginView::pluginForIndex(const QModelIndex &index) const
{
const QModelIndex &sourceIndex = m_sortModel->mapToSource(index);
PluginItem *item = m_model->secondLevelItemForIndex(sourceIndex);
PluginItem *item = m_model->itemForIndexAtLevel<2>(sourceIndex);
return item ? item->m_spec: 0;
}
......@@ -455,7 +455,7 @@ bool PluginView::setPluginsEnabled(const QSet<PluginSpec *> &plugins, bool enabl
QSet<PluginSpec *> affectedPlugins = plugins + additionalPlugins;
foreach (PluginSpec *spec, affectedPlugins) {
PluginItem *item = m_model->findSecondLevelItem([spec](PluginItem *item) {
PluginItem *item = m_model->findItemAtLevel<2>([spec](PluginItem *item) {
return item->m_spec == spec;
});
QTC_ASSERT(item, continue);
......
......@@ -71,7 +71,7 @@ private:
bool setPluginsEnabled(const QSet<PluginSpec *> &plugins, bool enable);
Utils::TreeView *m_categoryView;
Utils::LeveledTreeModel<Utils::TreeItem, Internal::CollectionItem, Internal::PluginItem> *m_model;
Utils::TreeModel<Utils::TreeItem, Internal::CollectionItem, Internal::PluginItem> *m_model;
QSortFilterProxyModel *m_sortModel;
friend class Internal::CollectionItem;
......
......@@ -777,6 +777,11 @@ QModelIndex TreeItem::index() const
return m_model->indexForItem(this);
}
QAbstractItemModel *TreeItem::model() const
{
return m_model;
}
void TreeItem::clear()
{
while (m_children.size()) {
......@@ -793,7 +798,7 @@ void TreeItem::expand()
m_model->requestExpansion(index());
}
void TreeItem::propagateModel(TreeModel *m)
void TreeItem::propagateModel(BaseTreeModel *m)
{
QTC_ASSERT(m, return);
QTC_ASSERT(m_model == 0 || m_model == m, return);
......@@ -811,7 +816,7 @@ void TreeItem::propagateModel(TreeModel *m)
to use in a QTreeView.
*/
TreeModel::TreeModel(QObject *parent)
BaseTreeModel::BaseTreeModel(QObject *parent)
: QAbstractItemModel(parent),
m_root(new TreeItem)
{
......@@ -822,7 +827,7 @@ TreeModel::TreeModel(QObject *parent)
#endif
}
TreeModel::TreeModel(TreeItem *root, QObject *parent)
BaseTreeModel::BaseTreeModel(TreeItem *root, QObject *parent)
: QAbstractItemModel(parent),
m_root(root)
{
......@@ -830,7 +835,7 @@ TreeModel::TreeModel(TreeItem *root, QObject *parent)
m_root->propagateModel(this);
}
TreeModel::~TreeModel()
BaseTreeModel::~BaseTreeModel()
{
QTC_ASSERT(m_root, return);
QTC_ASSERT(m_root->m_parent == 0, return);
......@@ -839,7 +844,7 @@ TreeModel::~TreeModel()
delete m_root;
}
QModelIndex TreeModel::parent(const QModelIndex &idx) const
QModelIndex BaseTreeModel::parent(const QModelIndex &idx) const
{
CHECK_INDEX(idx);
if (!idx.isValid())
......@@ -862,7 +867,7 @@ QModelIndex TreeModel::parent(const QModelIndex &idx) const
return QModelIndex();
}
int TreeModel::rowCount(const QModelIndex &idx) const
int BaseTreeModel::rowCount(const QModelIndex &idx) const
{
CHECK_INDEX(idx);
if (!idx.isValid())
......@@ -874,7 +879,7 @@ int TreeModel::rowCount(const QModelIndex &idx) const
return item->childCount();
}
int TreeModel::columnCount(const QModelIndex &idx) const
int BaseTreeModel::columnCount(const QModelIndex &idx) const
{
CHECK_INDEX(idx);
if (idx.column() > 0)
......@@ -882,7 +887,7 @@ int TreeModel::columnCount(const QModelIndex &idx) const
return m_columnCount;
}
bool TreeModel::setData(const QModelIndex &idx, const QVariant &data, int role)
bool BaseTreeModel::setData(const QModelIndex &idx, const QVariant &data, int role)
{
TreeItem *item = itemForIndex(idx);
bool res = item ? item->setData(idx.column(), data, role) : false;
......@@ -891,13 +896,13 @@ bool TreeModel::setData(const QModelIndex &idx, const QVariant &data, int role)
return res;
}
QVariant TreeModel::data(const QModelIndex &idx, int role) const
QVariant BaseTreeModel::data(const QModelIndex &idx, int role) const
{
TreeItem *item = itemForIndex(idx);
return item ? item->data(idx.column(), role) : QVariant();
}
QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
QVariant BaseTreeModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole && section < m_header.size())
......@@ -907,13 +912,13 @@ QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
return QVariant();
}
bool TreeModel::hasChildren(const QModelIndex &idx) const
bool BaseTreeModel::hasChildren(const QModelIndex &idx) const
{
TreeItem *item = itemForIndex(idx);
return !item || item->hasChildren();
}
Qt::ItemFlags TreeModel::flags(const QModelIndex &idx) const
Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const
{
if (!idx.isValid())
return 0;
......@@ -922,7 +927,7 @@ Qt::ItemFlags TreeModel::flags(const QModelIndex &idx) const
: (Qt::ItemIsEnabled|Qt::ItemIsSelectable);
}
bool TreeModel::canFetchMore(const QModelIndex &idx) const
bool BaseTreeModel::canFetchMore(const QModelIndex &idx) const
{
if (!idx.isValid())
return false;
......@@ -930,7 +935,7 @@ bool TreeModel::canFetchMore(const QModelIndex &idx) const
return item ? item->canFetchMore() : false;
}
void TreeModel::fetchMore(const QModelIndex &idx)
void BaseTreeModel::fetchMore(const QModelIndex &idx)
{
if (!idx.isValid())
return;
......@@ -939,17 +944,17 @@ void TreeModel::fetchMore(const QModelIndex &idx)
item->fetchMore();
}
TreeItem *TreeModel::rootItem() const
TreeItem *BaseTreeModel::rootItem() const
{
return m_root;
}
int TreeModel::topLevelItemCount() const
int BaseTreeModel::topLevelItemCount() const
{
return m_root->childCount();
}
void TreeModel::setRootItem(TreeItem *item)
void BaseTreeModel::setRootItem(TreeItem *item)
{
QTC_ASSERT(item, return);
QTC_ASSERT(item->m_model == 0, return);
......@@ -971,18 +976,18 @@ void TreeModel::setRootItem(TreeItem *item)
emit layoutChanged();
}
void TreeModel::setHeader(const QStringList &displays)
void BaseTreeModel::setHeader(const QStringList &displays)
{
m_header = displays;
m_columnCount = displays.size();
}
void TreeModel::setHeaderToolTip(const QStringList &tips)
void BaseTreeModel::setHeaderToolTip(const QStringList &tips)
{
m_headerToolTip = tips;
}
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
QModelIndex BaseTreeModel::index(int row, int column, const QModelIndex &parent) const
{
CHECK_INDEX(parent);
if (!hasIndex(row, column, parent))
......@@ -995,7 +1000,7 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con
return createIndex(row, column, (void*)(item->childAt(row)));
}
TreeItem *TreeModel::itemForIndex(const QModelIndex &idx) const
TreeItem *BaseTreeModel::itemForIndex(const QModelIndex &idx) const
{
CHECK_INDEX(idx);
TreeItem *item = idx.isValid() ? static_cast<TreeItem*>(idx.internalPointer()) : m_root;
......@@ -1004,7 +1009,7 @@ TreeItem *TreeModel::itemForIndex(const QModelIndex &idx) const
return item;
}
QModelIndex TreeModel::indexForItem(const TreeItem *item) const
QModelIndex BaseTreeModel::indexForItem(const TreeItem *item) const
{
QTC_ASSERT(item, return QModelIndex());
if (item == m_root)
......@@ -1021,7 +1026,7 @@ QModelIndex TreeModel::indexForItem(const TreeItem *item) const
/*!
Destroys all items in them model except the invisible root item.
*/
void TreeModel::clear()
void BaseTreeModel::clear()
{
if (m_root)
m_root->removeChildren();
......@@ -1033,7 +1038,7 @@ void TreeModel::clear()
\note The item is not destroyed, ownership is effectively passed to the caller.
*/
TreeItem *TreeModel::takeItem(TreeItem *item)
TreeItem *BaseTreeModel::takeItem(TreeItem *item)
{
#if USE_MODEL_TEST
(void) new ModelTest(this, this);
......@@ -1054,7 +1059,7 @@ TreeItem *TreeModel::takeItem(TreeItem *item)
return item;
}
void TreeModel::destroyItem(TreeItem *item)
void BaseTreeModel::destroyItem(TreeItem *item)
{
delete takeItem(item);
}
......
This diff is collapsed.
......@@ -128,7 +128,7 @@ void TestResultItem::updateResult()
/********************************* TestResultModel *****************************************/
TestResultModel::TestResultModel(QObject *parent)
: Utils::TreeModel(parent),
: Utils::TreeModel<>(parent),
m_widthOfLineNumber(0),
m_maxWidthOfFileName(0),
m_disabled(0)
......
......@@ -51,7 +51,7 @@ private:
TestResultPtr m_testResult;
};
class TestResultModel : public Utils::TreeModel
class TestResultModel : public Utils::TreeModel<>
{
public:
explicit TestResultModel(QObject *parent = 0);
......
......@@ -42,7 +42,7 @@ namespace Autotest {
namespace Internal {
TestTreeModel::TestTreeModel(QObject *parent) :
TreeModel(parent),
TreeModel<>(parent),
m_parser(new TestCodeParser(this)),
m_connectionsInitialized(false)
{
......
......@@ -40,7 +40,7 @@ class TestParseResult;
using TestParseResultPtr = QSharedPointer<TestParseResult>;
class TestTreeModel : public Utils::TreeModel
class TestTreeModel : public Utils::TreeModel<>
{
Q_OBJECT
public:
......
......@@ -94,7 +94,7 @@ public:
GdbServerProviderModel::GdbServerProviderModel(QObject *parent)
: TreeModel(parent)
: TreeModel<>(parent)
{
setHeader({tr("Name"), tr("Type")});
......
......@@ -46,7 +46,7 @@ class GdbServerProviderFactory;
class GdbServerProviderNode;
class GdbServerProvidersSettingsWidget;
class GdbServerProviderModel : public Utils::TreeModel
class GdbServerProviderModel : public Utils::TreeModel<>
{
Q_OBJECT
......
......@@ -66,7 +66,7 @@ private:
};
ClangStaticAnalyzerDiagnosticModel::ClangStaticAnalyzerDiagnosticModel(QObject *parent)
: Utils::TreeModel(parent)
: Utils::TreeModel<>(parent)
{
setHeader(QStringList() << tr("Issue") << tr("Location"));
}
......
......@@ -40,7 +40,7 @@ namespace ProjectExplorer { class Project; }
namespace ClangStaticAnalyzer {
namespace Internal {
class ClangStaticAnalyzerDiagnosticModel : public Utils::TreeModel
class ClangStaticAnalyzerDiagnosticModel : public Utils::TreeModel<>
{
Q_OBJECT
......
......@@ -57,7 +57,7 @@ class CMakeToolTreeItem;
// CMakeToolItemModel
// --------------------------------------------------------------------------
class CMakeToolItemModel : public LeveledTreeModel<TreeItem, TreeItem, CMakeToolTreeItem>
class CMakeToolItemModel : public TreeModel<TreeItem, TreeItem, CMakeToolTreeItem>
{
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::CMakeSettingsPage)
......@@ -229,12 +229,12 @@ void CMakeToolItemModel::updateCMakeTool(const Core::Id &id, const QString &disp
CMakeToolTreeItem *CMakeToolItemModel::cmakeToolItem(const Core::Id &id) const
{
return findSecondLevelItem([id](CMakeToolTreeItem *n) { return n->m_id == id; });
return findItemAtLevel<2>([id](CMakeToolTreeItem *n) { return n->m_id == id; });
}
CMakeToolTreeItem *CMakeToolItemModel::cmakeToolItem(const QModelIndex &index) const
{
return secondLevelItemForIndex(index);
return itemForIndexAtLevel<2>(index);
}
void CMakeToolItemModel::removeCMakeTool(const Core::Id &id)
......@@ -252,7 +252,7 @@ void CMakeToolItemModel::apply()
CMakeToolManager::deregisterCMakeTool(id);
QList<CMakeToolTreeItem *> toRegister;
forSecondLevelItems([&toRegister](CMakeToolTreeItem *item) {
forItemsAtLevel<2>([&toRegister](CMakeToolTreeItem *item) {
item->m_changed = false;
if (CMakeTool *cmake = CMakeToolManager::findById(item->m_id)) {
cmake->setDisplayName(item->m_name);
......@@ -304,7 +304,7 @@ void CMakeToolItemModel::setDefaultItemId(const Core::Id &id)
QString CMakeToolItemModel::uniqueDisplayName(const QString &base) const
{
QStringList names;
forSecondLevelItems([&names](CMakeToolTreeItem *item) { names << item->m_name; });
forItemsAtLevel<2>([&names](CMakeToolTreeItem *item) { names << item->m_name; });
return ProjectExplorer::Project::makeUnique(base, names);
}
......
......@@ -190,7 +190,7 @@ QWidget *LocatorSettingsPage::widget()
m_ui.filterList->setUniformRowHeights(true);
m_ui.filterList->setActivationMode(Utils::DoubleClickActivation);
m_model = new TreeModel(m_ui.filterList);
m_model = new TreeModel<>(m_ui.filterList);
initializeModel();
m_proxyModel = new CategorySortFilterModel(m_ui.filterList);
m_proxyModel->setSourceModel(m_model);
......
......@@ -28,6 +28,7 @@
#include "ui_locatorsettingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/treemodel.h>
#include <QHash>
#include <QPointer>
......@@ -37,13 +38,6 @@ class QListWidgetItem;
class QSortFilterProxyModel;
QT_END_NAMESPACE
namespace Utils {
class TreeModel;
class TreeItem;
} // Utils
namespace Core {
class ILocatorFilter;
......@@ -77,7 +71,7 @@ private:
Ui::LocatorSettingsWidget m_ui;
Locator *m_plugin;
QPointer<QWidget> m_widget;
Utils::TreeModel *m_model;
Utils::TreeModel<> *m_model;
QSortFilterProxyModel *m_proxyModel;
Utils::TreeItem *m_customFilterRoot;
QList<ILocatorFilter *> m_filters;
......
......@@ -109,7 +109,7 @@ public:
public:
VariableChooser *q;
TreeModel m_model;
TreeModel<> m_model;
QPointer<QLineEdit> m_lineEdit;
QPointer<QTextEdit> m_textEdit;
......
......@@ -947,7 +947,7 @@ static bool isSimilarTo(const BreakpointParameters &params, const BreakpointResp
Breakpoint BreakHandler::findSimilarBreakpoint(const BreakpointResponse &needle) const
{
// Search a breakpoint we might refer to.
return Breakpoint(findFirstLevelItem([needle](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([needle](BreakpointItem *b) {
if (b->m_response.id.isValid() && b->m_response.id.majorPart() == needle.id.majorPart())
return true;
return isSimilarTo(b->m_params, needle);
......@@ -956,21 +956,21 @@ Breakpoint BreakHandler::findSimilarBreakpoint(const BreakpointResponse &needle)
Breakpoint BreakHandler::findBreakpointByResponseId(const BreakpointResponseId &id) const
{
return Breakpoint(findFirstLevelItem([id](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([id](BreakpointItem *b) {
return b->m_response.id.majorPart() == id.majorPart();
}));
}
Breakpoint BreakHandler::findBreakpointByFunction(const QString &functionName) const
{
return Breakpoint(findFirstLevelItem([functionName](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([functionName](BreakpointItem *b) {
return b->m_params.functionName == functionName;
}));
}
Breakpoint BreakHandler::findBreakpointByAddress(quint64 address) const
{
return Breakpoint(findFirstLevelItem([address](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([address](BreakpointItem *b) {
return b->m_params.address == address || b->m_params.address == address;
}));
}
......@@ -978,14 +978,14 @@ Breakpoint BreakHandler::findBreakpointByAddress(quint64 address) const
Breakpoint BreakHandler::findBreakpointByFileAndLine(const QString &fileName,
int lineNumber, bool useMarkerPosition)
{
return Breakpoint(findFirstLevelItem([=](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([=](BreakpointItem *b) {
return b->isLocatedAt(fileName, lineNumber, useMarkerPosition);
}));
}
Breakpoint BreakHandler::breakpointById(BreakpointModelId id) const
{
return Breakpoint(findFirstLevelItem([id](BreakpointItem *b) { return b->m_id == id; }));
return Breakpoint(findItemAtLevel<1>([id](BreakpointItem *b) { return b->m_id == id; }));
}
QVariant BreakHandler::data(const QModelIndex &idx, int role) const
......@@ -1005,7 +1005,7 @@ void BreakHandler::deletionHelper(BreakpointModelId id)
Breakpoint BreakHandler::findWatchpoint(const BreakpointParameters &params) const
{
return Breakpoint(findFirstLevelItem([params](BreakpointItem *b) {
return Breakpoint(findItemAtLevel<1>([params](BreakpointItem *b) {
return b->m_params.isWatchpoint()
&& b->m_params.address == params.address
&& b->m_params.size == params.size
......@@ -1017,7 +1017,7 @@ Breakpoint BreakHandler::findWatchpoint(const BreakpointParameters &params) cons
void BreakHandler::saveBreakpoints()
{
QList<QVariant> list;
forFirstLevelItems([&list](BreakpointItem *b) {
forItemsAtLevel<1>([&list](BreakpointItem *b) {
const BreakpointParameters &params = b->m_params;
QMap<QString, QVariant> map;
if (params.type != BreakpointByFileAndLine)
......@@ -1121,12 +1121,12 @@ void BreakHandler::loadBreakpoints()
void BreakHandler::updateMarkers()
{
forFirstLevelItems([](BreakpointItem *b) { b->updateMarker(); });
forItemsAtLevel<1>([](BreakpointItem *b) { b->updateMarker(); });
}
Breakpoint BreakHandler::findBreakpointByIndex(const QModelIndex &index) const
{
return Breakpoint(firstLevelItemForIndex(index));
return Breakpoint(itemForIndexAtLevel<1>(index));
}
Breakpoints BreakHandler::findBreakpointsByIndex(const QList<QModelIndex> &list) const
......@@ -1736,7 +1736,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
{
// One breakpoint per function is enough for now. This does not handle
// combinations of multiple conditions and ignore counts, though.
bool found = findFirstLevelItem([functionName](BreakpointItem *b) {
bool found = findItemAtLevel<1>([functionName](BreakpointItem *b) {
const BreakpointParameters &params = b->m_params;
return params.functionName == functionName
&& params.condition.isEmpty()
......@@ -1828,7 +1828,7 @@ void BreakHandler::changeLineNumberFromMarkerHelper(BreakpointModelId id)
Breakpoints BreakHandler::allBreakpoints() const
{
Breakpoints items;
forFirstLevelItems([&items](BreakpointItem *b) { items.append(Breakpoint(b)); });
forItemsAtLevel<1>([&items](BreakpointItem *b) { items.append(Breakpoint(b)); });
return items;
}
......@@ -1840,7 +1840,7 @@ Breakpoints BreakHandler::unclaimedBreakpoints() const
Breakpoints BreakHandler::engineBreakpoints(DebuggerEngine *engine) const
{
Breakpoints items;
forFirstLevelItems([&items, engine](BreakpointItem *b) {
forItemsAtLevel<1>([&items, engine](BreakpointItem *b) {
if (b->m_engine == engine)
items.append(Breakpoint(b));
});
......@@ -1850,7 +1850,7 @@ Breakpoints BreakHandler::engineBreakpoints(DebuggerEngine *engine) const
QStringList BreakHandler::engineBreakpointPaths(DebuggerEngine *engine) const
{
QSet<QString> set;
forFirstLevelItems([&set, engine](BreakpointItem *b) {
forItemsAtLevel<1>([&set, engine](BreakpointItem *b) {
if (b->m_engine == engine) {
if (b->m_params.type == BreakpointByFileAndLine)
set.insert(QFileInfo(b->m_params.fileName).dir().path());
......@@ -1990,7 +1990,7 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
[this] { deleteAllBreakpoints(); });
// Delete by file: Find indices of breakpoints of the same file.
BreakpointItem *item = firstLevelItemForIndex(ev.index());
BreakpointItem *item = itemForIndexAtLevel<1>(ev.index());
Breakpoints breakpointsInFile;
QString file;
if (item) {
......
......@@ -159,7 +159,7 @@ inline uint qHash(const Debugger::Internal::Breakpoint &b) { return b.hash(); }
typedef QList<Breakpoint> Breakpoints;
using BreakModel = Utils::LeveledTreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, LocationItem>;
using BreakModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, LocationItem>;
class BreakHandler : public BreakModel
{
......
......@@ -38,7 +38,7 @@ namespace Internal {
///////////////////////////////////////////////////////////////////////
ConsoleItemModel::ConsoleItemModel(QObject *parent) :
Utils::TreeModel(new ConsoleItem, parent),
Utils::TreeModel<>(new ConsoleItem, parent),
m_maxSizeOfFileName(0)
{
clear();
......@@ -46,7 +46,7 @@ ConsoleItemModel::ConsoleItemModel(QObject *parent) :
void ConsoleItemModel::clear()
{
Utils::TreeModel::clear();
Utils::TreeModel<>::clear();
appendItem(new ConsoleItem(ConsoleItem::InputType));
emit selectEditableRow(index(0, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
}
......
......@@ -37,7 +37,7 @@ QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
class ConsoleItemModel : public Utils::TreeModel
class ConsoleItemModel : public Utils::TreeModel<>
{
Q_OBJECT
public:
......
......@@ -99,7 +99,7 @@ public:
// DebuggerItemModel
// --------------------------------------------------------------------------
class DebuggerItemModel : public LeveledTreeModel<TreeItem, StaticTreeItem, DebuggerTreeItem>
class DebuggerItemModel : public TreeModel<TreeItem, StaticTreeItem, DebuggerTreeItem>
{
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerOptionsPage)
......@@ -139,7 +139,7 @@ void DebuggerItemModel::addDebugger(const DebuggerItem &item, bool changed)
void DebuggerItemModel::updateDebugger(const DebuggerItem &item)
{
auto matcher = [item](DebuggerTreeItem *n) { return n->m_item.m_id == item.id(); };
DebuggerTreeItem *treeItem = findSecondLevelItem(matcher);
DebuggerTreeItem *treeItem = findItemAtLevel<2>(matcher);
QTC_ASSERT(treeItem, return);
TreeItem *parent = treeItem->parent();
......@@ -178,7 +178,7 @@ void DebuggerItemModel::apply()
foreach (const QVariant &id, m_removedItems)
DebuggerItemManager::deregisterDebugger(id);
forSecondLevelItems([](DebuggerTreeItem *item) {
forItemsAtLevel<2>([](DebuggerTreeItem *item) {
item->m_changed = false;
DebuggerItemManager::updateOrAddDebugger(item->m_item);
});
......
......@@ -212,8 +212,8 @@ public:
ToolTipWatchItem::ToolTipWatchItem(TreeItem *item)
{
const TreeModel *model = item->model();
QModelIndex idx = model->indexForItem(item);
const QAbstractItemModel *model = item->model();