Don't do anything, just press the instructions and write a bunch of code.
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
//open datebase
db.setDatabaseName("data.db");
if(!db.open()){
qDebug()<<"Could not open file!"<<endl;
}else{
qDebug()<<"Open file: "<<db.databaseName()<<" sucessfully!"<<endl;
}
//creat the date model
QSqlRelationalTableModel *model;
model = new QSqlRelationalTableModel(defectDbTableView);
//set table
model->setTable("product");
//select data
model->select();
defectDbTableView->setModel(model);
Of course, Brother also
#include <QSqlDatabase>
#include <QSqlRelationalTableModel>
Sister Oh, or say the division did not find the error LNK2019: unresolved external symbol "__declspec (dllimport) public: __thiscall Qsqldatabase, That's not a stupid thing to do. No DLL library or what lib? Well, go and see if there's anything.
This is not everything, OK, to the elder brother personally add, and remember Oh, not add plugin inside these things, two paths remember to look at the picture
All right, compile and pass, wash our asses for Our Lady.
QT's SQLite connection