TreeView Tree Model
-
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 ? -
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.
@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.@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?
-
-"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?