11char* --------------QByteArray(const char*)-----------> QByteArray
char* str;
QByteArray byte(str);
char* --------------QString(const char*)-------------->QString
char* str;
QString string(str);
QByteArray -------------data()------------------------------>char*
QByteArray byte;
char* str = byte.data();
QByteArray ------------QString()------------------->QString
1.QByteArray byte;
QString string(byte);
2.数据流的方式
QByteArray encodedString = "xxx";
QTextCodec *codec = QTextCodec::codecForName("KOI8-R");
QString string = codec->toUnicode(encodedString)
QString --------------toAscii()--------------------> QByteArray
QString string;
QByteArray byte = string.toAscii();
QByteArray bytes = string.toLatin1();
//Qt提供了一个宏qPrintable(),这个宏等价于toAscii().constData()
QString -------------qPrintable()------------------>char*
QString string;
char* str = qPrintable(string);
QString ------------toInt()-------------------------->int
QString str;
int a = str.toInt();
int-----------------number()--------------------------->QString
int a;
QString b=QString::number(a);