|
新手 请问 qt5的中文乱码问题 如何解决??
下面是源码
static bool createConnection() {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("database.db");
if(!db.open())
return false;
QSqlQuery query;
query.exec(QObject::tr("create table student (id int primary key, name vchar)"));
query.exec(QObject::tr("insert into student values (0,'刘明')"));
query.exec(QObject::tr("insert into student values (1,'陈刚')"));
query.exec(QObject::tr("insert into student values (2,'王红')"));
return true;
}
发现把汉字改为英文依然是乱码?
很纠结。。。。
|
|