+QModelIndex TreeModel::indexById(uint id, const QModelIndex &parent) const {
+ TreeItem *parentItem;
+
+ if(!parent.isValid())
+ parentItem = rootItem;
+ else
+ parentItem = static_cast<TreeItem *>(parent.internalPointer());
+
+ TreeItem *childItem = parentItem->childById(id);
+ if(childItem)
+ return createIndex(childItem->row(), 0, childItem);
+ else
+ return QModelIndex();
+}
+