QByteArray out_val; QString dataString(ui->inputLINE->text()); QStringList list; int i = 0; QString tmpString; while(0 != (tmpString = dataString.mid(i, 2))) { list.append(tmpString); i +=2; } foreach (QString str, list) { uint value = str.toUInt(NULL, 16); out_val.append((quint8)value); } qDebug()<<out_val.toHex(); quint32 abc; abc = out_val[0]+ out_val[1]; qDebug()<<abc;
QByteArray out_val; QString dataString(ui->inputLINE->text()); int i = 0; QString tmpString; while(0 != (tmpString = dataString.mid(i, 2))) { out_val.append((quint8)(tmpString.toUInt(NULL, 16))); i +=2; }