Commit 22f929ea authored by hjk's avatar hjk Committed by David Schulz

CppTools: Fix recent regression in type hierarchy model

Change-Id: I9fe462a61f32884b422ad402b18f17b44b60c7ab
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent b515768d
......@@ -183,24 +183,24 @@ void CppTypeHierarchyWidget::perform()
m_inspectedClass->setup(cppClass);
QStandardItem *bases = new QStandardItem(tr("Bases"));
m_model->invisibleRootItem()->appendRow(bases);
buildHierarchy(*cppClass, bases, true, cppClass->bases);
buildHierarchy(*cppClass, bases, true, &CppClass::bases);
QStandardItem *derived = new QStandardItem(tr("Derived"));
m_model->invisibleRootItem()->appendRow(derived);
buildHierarchy(*cppClass, derived, true, cppClass->derived);
buildHierarchy(*cppClass, derived, true, &CppClass::derived);
m_treeView->expandAll();
}
}
}
void CppTypeHierarchyWidget::buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, const QList<CppClass> &classes)
void CppTypeHierarchyWidget::buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, const HierarchyMember member)
{
if (!isRoot) {
QStandardItem *item = itemForClass(cppClass);
parent->appendRow(item);
parent = item;
}
foreach (const CppClass &klass, sortClasses(classes))
buildHierarchy(klass, parent, false, classes);
foreach (const CppClass &klass, sortClasses(cppClass.*member))
buildHierarchy(klass, parent, false, member);
}
void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index)
......
......@@ -75,7 +75,8 @@ private slots:
void onItemClicked(const QModelIndex &index);
private:
void buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, const QList<CppClass> &classes);
typedef QList<CppClass> CppClass::*HierarchyMember;
void buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, HierarchyMember member);
CPPEditorWidget *m_cppEditor;
Utils::NavigationTreeView *m_treeView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment