TreeView Tree Model
-
wrote on 25 Feb 2022, 11:16 last edited byThis post is deleted!
-
wrote on 26 Feb 2022, 04:59 last edited by
the slightest help would be appreciated.
-
Hi
im not sure what effect you are after.
So you want them to open on same level as parent so its more like a table than a tree ?Parent1 (click)
Parent1 -> Child1
and the other parents have nothing in col 2 unless expanded ? -
wrote on 28 Feb 2022, 07:12 last edited by
yess.
as you said, like this:
parent1 -> child1 -> child2 -> child3 ...
parent2 -> child1->child2-> child3 ...
// that is, all children of the parent will be on the same row.need any help for this, thanks.
-
yess.
as you said, like this:
parent1 -> child1 -> child2 -> child3 ...
parent2 -> child1->child2-> child3 ...
// that is, all children of the parent will be on the same row.need any help for this, thanks.
wrote on 28 Feb 2022, 10:02 last edited by@Nevez
My thought would be: it does sound like the structure you want to present forQTreeView
to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see. -
@Nevez
My thought would be: it does sound like the structure you want to present forQTreeView
to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see.wrote on 2 Mar 2022, 12:29 last edited by@JonB said in TreeView Tree Model:
My thought would be: it does sound like the structure you want to present for QTreeView to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see.
I saw what you said. I need some fresh examples or tips as I have never used a proxy before. If you have a source can you send it?
-
wrote on 3 Mar 2022, 08:29 last edited by Nevez 3 Mar 2022, 08:30
-"id" -"name" "-surname" - 1 -"John" "-salt" - 2 -"Peter""-jenns" -...
QSortProxyModel to create this structure? or QIdentyProxyModel ? Would it be better if I use it? And I have no idea how to implement fromMapSource and mapToSource in particular. Can anyone explain with examples please?
1/7