mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 10:45:39 +03:00
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:
parent
3b9b8ae629
commit
6d0208a686
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user