1、QByteArray转十六进制
QByteArray buff = sp->readAll();
qDebug() << buff.toHex() << " len: " << nLen;
2、Char转十六进制
QByteArray buff;
buff.resize( 2);
buff[0] = 0x55;
buff[1] = 0x45;
QString strHex = QString::number( buff.at(0), 16);
3、QString转QByteArray
QByteArray text = QByteArray::fromHex(strHex.toLatin1());