passing model class



  • Hi there,

    I have a QStandardItemModel model (i.e,: QStandardItemModel *model;) made in mainwindow header code. I am passing it to a class SetDefault to put some default values in the model class. To do so, in mainwindow code I pass "&mode "and in class SetDefault get it as argument SetDefault (QStandardItemModel **_model). Next I set values in the passed model in such a way: (*_model)->setData(index,dat);
    Code runs, however, when i get the model back in mainwindow no changes was made to the model class! I have checked and the memory address of model class in the mainwindow is the same as the memory address of " *_model " in SetDefault class. But the model doesn't show changes after being back in the mainwindow.

    Any help is appreciated.

    Omid


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Please share the code where you create the model as well as the one you are using to modify it.



  • why passing a double pointer instead of just the QStandardItemModel* ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.