Commit ad49b686 authored by hjk's avatar hjk

TreeModel: Some extra checking

Change-Id: I75751c792b22998990ef453d51b9586fdaf31f50
Reviewed-by: default avatarEike Ziller <>
parent f02e09f6
......@@ -1003,8 +1003,11 @@ QModelIndex TreeModel::indexForItem(const TreeItem *item) const
if (item == m_root)
return QModelIndex();
TreeItem *p = item->parent();
QTC_ASSERT(p, return QModelIndex());
TreeItem *mitem = const_cast<TreeItem *>(item);
int row = item->parent()->m_children.indexOf(mitem);
int row = p->m_children.indexOf(mitem);
return createIndex(row, 0, mitem);
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