[Partial Solve]Can't access QSqlQueryModel database programmatically



  • Why can't I access QSqlQueryModel member functions programmaticaly as described in the "documentation":http://qt-project.org/doc/qt-4.8/qsqlquerymodel.html? What am I not considering?

    I was able to access it when I tested; before I started passing the QSqlQueryModel data between classes. Any advice is welcome. "My failed class code example here":http://qt-project.org/forums/viewthread/19590/.

    I am passing data from the QSqlQueryModel as a widget to a control class that shares it with its widgets. I have passed the model seemingly successful (no error code output) though a pointers because I access some basic members like rowCount().

    @int intTest = model->rowCount();@
    

    What can’t I access the values in the standard fashion:

    @QString stringTest = model->record(i).value("firstName").toString();@


  • Here is the answer I am looking for, or at least partially:
    @
    QString stringTest = model->data(model->index(i,3)).toString();@


Log in to reply
 

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