Learn a week of qt, implement a small project now encountered a problem of a long afternoon, is the only show in the tableview header data (headers and database content), but on the surface of the table does not display the content, how to solve? As shown in figure
This is the inside of the database data
This is code section
Ps: in addition to the CPP file, I also carried out in login CPP file database connections, but when switching to the interface, I shut down the database connection, and then reconnect the database, don't know if there is problem,
CodePudding user response:
QSqlTableModel * pModel=new QSqlTableModel (this, _db); You'll have no Model and the database binding