PDA

View Full Version : QSqlQueryModel -> QTreeView



smrtak
22nd August 2008, 01:24
Hello,
i have problem with make tree model from flat sql data (by parent_id), i dont find simple example.
I must use proxy model ? Or its any new feautures for QSqlQueryModel ?

thx for help

wysota
22nd August 2008, 01:37
You have to implement a proxy model. It's not that hard (although not trivial in this particular case), believe me.

smrtak
23rd August 2008, 14:19
You have to implement a proxy model. It's not that hard (although not trivial in this particular case), believe me.


and exist any example?? again lost

i must make 'recruisive foreach'?

wysota
24th August 2008, 19:12
I have the code that does something like that but I can't show it to you :( I can give you a hint though. Think how to map indexes between a flat model and a hierarchical one. Write down the solution on a piece of paper and then implement mapFromIndex() and mapToIndex() according to your notes. The rest should be easy.