将QString转换为十六进制?

mrg*_*g95 3 c++ qstring qt hex ascii

我有一个QString,我从用户附加数据输入.

在QString的末尾,我需要附加"Normal"QString的十六进制表示.

例如:

QString Test("ff00112233440a0a");
QString Input("Words");

Test.append(Input);//but here is where Input needs to be the Hex representation of "Words"

//The resulting variable should be
//Test == "ff00112233440a0a576f726473";
Run Code Online (Sandbox Code Playgroud)

如何从ASCII(我认为)转换为十六进制表示?

谢谢你的时间.

deG*_*oot 9

你非常接近:

Test.append(QString::fromLatin1(Input.toLatin1().toHex()));