Qt World Summit: Register Today!

[resolved] what's wrong ? how to see datas inside the tree from QAbstractItemModel construction ?

  • I try to see my datas (and edit, delete, add...) from a database inside a treeview.
    So... i use the model of exemple from the doc (who seems to be clear now for me...) and arrive to bring datas from database isnide the model... BUT... i think i forgget something because i not see nothing inside the tree. No error... the debugger show me that all datas seems to be in place... each parent from root show these childs, and each childs show datas of there parents (ref of them is ok, perfect adress), datas inside the header is present and visibles in the UI tree, datas inside each object (here: classeur/binder) are ok (only column 0 and 1 has to be show on screen, but there is 5 columns... by commodity of coding), but columns datas are never been shown on the screen inside the tree.
    I don't know why... i define the model directly inside the treeview, and not from the caller for diminuate the code and make it easier to use, so model is setup... i have some more memeber inside the QAbstactItemModel for make it easier to use (and then, i can not call them directly from a model give by treeview->model(), because this give me back QAbstractItemModel and not CLasseurs_Model... so i pass the model by argument each time and call it by memory of the model created)...

    something not works like i do, but i don't know what and why...
    here is all the code concerned by model/view and use of it:

    thanks for any help.

  • ok, i have it...
    i can not call the model from the inherited treeview class. i need to conform to the doc.
    Also, i can not add Item by the way i done... i havce to insertRow and setData, if not, the "data()" method never call and model/view link not works without any error generate too.

    so... this pb of use is resolved
    i will open an other one around model/view for an other one knid of strange thinks...

Log in to reply