How can i convert a QByteArray into a hex string?
问题 I have the blow QByteArray. QByteArray ba; ba[0] = 0x01; ba[1] = 0x10; ba[2] = 0x00; ba[3] = 0x07; I have really no idea how to convert this QByteArray into resulted string which have " 01100007 ", which i would use the QRegExp for pattern matching on this string? 回答1: First of all, the QByteArray does not contain "hex values", it contains bytes (as it's name implies). Number can be "hex" only when it is printed as text. Your code should be: QByteArray ba(4, 0); // array length 4, filled with