Implement index also in the case of a listview. There the name is the complete path and child must not be used to create full path

This commit is contained in:
Martin Marmsoler 2023-04-26 22:52:38 +02:00
parent 3b9b8ae629
commit 6d0208a686

View File

@ -170,14 +170,21 @@ QModelIndex DiffTreeModel::index(Node *n) const {
}
QModelIndex DiffTreeModel::index(const QString &name) const {
auto list = name.split("/");
if (list.length() == 0)
return QModelIndex();
if (mListView) {
for (auto c : mRoot->children()) {
if (c->name() == name)
return index(c);
}
} else {
auto list = name.split("/");
if (list.length() == 0)
return QModelIndex();
for (auto c : mRoot->children()) {
auto n = c->child(list, 0);
if (n)
return index(n);
for (auto c : mRoot->children()) {
auto n = c->child(list, 0);
if (n)
return index(n);
}
}
return QModelIndex();