//QString -> C++ string -> char * str.ToStdString().data(); //先转换为C++的标准编码 //QString -> QByteArray QString buf = "123456"; QByteArray a = buf.toUtf8();//中文 a = buf.toLocal8Bit(); //转换为本地编码 //QByteArray -> char * char *b = a.data() //char * -> QString char *p = "123" QString c = QString(p);