QTextCodec *codec;codec=QTextCodec::codecForName("utf8");QTextCodec::setCodecForCStrings(codec);QTextCodec::setCodecForLocale(codec);QTextCodec::setCodecForTr(codec);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");db.setDatabaseName("mytest");db.setUserName("root");db.setPassword("57r80t10");db.setHostName("localhost");QSqlQuery query; query.exec("SET NAMES utf8");
query.prepare("INSERT INTO test(status) VALUES(:st)");query.bindValue(":st", lineEdit->text());query.exec();